/* Reset & Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette - Customized based on new Phetsaowani Kitty Logo */
    --bg-primary: #FFF9F6;       /* Warm soft cream with orange/pink tint */
    --bg-card: #FFFFFF;          /* Pure White */
    --primary: #FF57A0;          /* Vibrant Bubblegum Pink */
    --primary-hover: #E9438B;    /* Darker Pink */
    --primary-dark: #C22A6F;     /* Deep Magenta/Raspberry */
    --secondary: #FFF59D;        /* Pastel Yellow Curtain Color */
    --text-main: #4A3631;        /* Warm Cocoa Brown for readability */
    --text-muted: #8E7772;       /* Soft warm grey-brown */
    --border-color: #FFE5EE;     /* Soft Pinkish Border */
    --shadow-sm: 0 4px 6px -1px rgba(255, 87, 160, 0.04), 0 2px 4px -1px rgba(74, 54, 49, 0.02);
    --shadow-md: 0 10px 15px -3px rgba(255, 87, 160, 0.06), 0 4px 6px -2px rgba(74, 54, 49, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(255, 87, 160, 0.09), 0 10px 10px -5px rgba(74, 54, 49, 0.04);
    
    /* Status Colors */
    --status-pending-bg: #FFF8E1;
    --status-pending-text: #E65100;
    --status-transit-bg: #FFF0F6;
    --status-transit-text: #FF57A0;
    --status-ready-bg: #E0F2F1;          /* Mint Green matching the kitty's eyes */
    --status-ready-text: #00796B;
    --status-error-bg: #FFEBEE;
    --status-error-text: #F44336;
}

body {
    font-family: 'Mitr', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* Background floating decorations */
.decorations {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.floating-icon {
    position: absolute;
    color: var(--primary);
    opacity: 0.12;
    font-size: 2rem;
    animation: float 12s ease-in-out infinite alternate;
}

.icon-1 { top: 10%; left: 8%; animation-delay: 0s; }
.icon-2 { top: 15%; right: 10%; animation-delay: 2s; font-size: 2.5rem; }
.icon-3 { top: 55%; left: 5%; animation-delay: 4s; }
.icon-4 { top: 40%; right: 7%; animation-delay: 1s; font-size: 1.8rem; }
.icon-5 { top: 80%; left: 12%; animation-delay: 3s; font-size: 2.2rem; }
.icon-6 { top: 75%; right: 8%; animation-delay: 5s; }

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(-20px) rotate(15deg);
    }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 800px;
    padding: 3rem 1.5rem;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header Section */
.shop-header {
    text-align: center;
    margin-bottom: 1rem;
    animation: fadeInDown 0.8s ease-out;
}

.logo-wrapper {
    display: inline-block;
    width: 140px;
    height: 140px;
    border-radius: 24px;
    background-color: var(--bg-card);
    padding: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.2rem;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo-wrapper:hover {
    transform: scale(1.08) rotate(3deg);
}

.shop-logo {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    object-fit: cover;
}

.shop-title {
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.2rem;
    letter-spacing: -0.5px;
}

.shop-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* Stats Overview Section */
.stats-section {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.section-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    background-color: var(--bg-primary);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background-color: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--primary);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Search Section */
.search-section {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.search-card {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.search-label {
    font-size: 1.1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-label i {
    color: var(--primary-dark);
}

.search-input-group {
    display: flex;
    gap: 0.8rem;
    width: 100%;
}

.input-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 0 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(234, 160, 162, 0.15);
}

.at-symbol {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-right: 0.2rem;
    user-select: none;
}

#twitter-search {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.8rem 0;
    font-family: 'Mitr', sans-serif;
    font-size: 1.1rem;
    color: var(--text-main);
    outline: none;
}

#twitter-search::placeholder {
    color: #B2A6A5;
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem;
    display: none; /* Controlled by JS */
    transition: color 0.2s ease;
}

.clear-btn:hover {
    color: var(--primary-dark);
}

.search-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 0 1.8rem;
    font-family: 'Mitr', sans-serif;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(234, 160, 162, 0.3);
}

.search-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(234, 160, 162, 0.4);
}

.search-btn:active {
    transform: translateY(1px);
}

/* Recent Searches */
.recent-searches {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    animation: fadeIn 0.4s ease-out;
}

.recent-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.recent-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chip {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.chip:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
}

.chip-remove {
    font-size: 0.75rem;
    opacity: 0.7;
    cursor: pointer;
}

.chip-remove:hover {
    opacity: 1;
}

/* Status Containers (Welcome, Loading, Not Found, Error) */
.status-container {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    animation: fadeIn 0.6s ease-out;
}

.illustration-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.welcome-illustration-icon {
    font-size: 2.2rem;
    color: var(--primary);
}

.not-found-illustration-icon {
    font-size: 2.5rem;
    color: #FFB84C;
}

.error-illustration-icon {
    font-size: 2.5rem;
    color: var(--status-error-text);
}

.status-text {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.cute-spinner {
    font-size: 2.5rem;
    color: var(--primary);
    animation: spin 1s linear infinite;
}

.tips-box {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-left: 4px solid var(--primary);
    max-width: 450px;
    text-align: left;
}

.tip-title {
    font-weight: 500;
    color: var(--text-main);
    display: block;
    margin-bottom: 0.2rem;
}

.retry-btn {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-family: 'Mitr', sans-serif;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.retry-btn:hover {
    background-color: var(--status-error-bg);
    color: var(--status-error-text);
    border-color: var(--status-error-text);
}

/* Results Section */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: fadeInUp 0.8s ease-out;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.5rem;
}

.results-header h2 {
    font-size: 1.3rem;
    font-weight: 500;
}

.user-highlight {
    color: var(--primary-dark);
    font-weight: 600;
}

.item-count-badge {
    background-color: var(--primary);
    color: white;
    padding: 0.25rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Preorder Cards */
.preorder-card {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 1.8rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.preorder-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.product-name {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.4;
}

.order-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Status Badges */
.status-badge {
    padding: 0.4rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.status-badge.pending {
    background-color: var(--status-pending-bg);
    color: var(--status-pending-text);
}

.status-badge.transit {
    background-color: var(--status-transit-bg);
    color: var(--status-transit-text);
}

.status-badge.ready {
    background-color: var(--status-ready-bg);
    color: var(--status-ready-text);
}

/* Card Attributes Grid */
.card-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 2rem;
    background-color: var(--bg-primary);
    padding: 1.2rem;
    border-radius: 14px;
    border: 1px solid var(--border-color);
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detail-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.detail-value i {
    color: var(--primary);
}

/* Note Section */
.card-note {
    background-color: #FFFDF9;
    border: 1px dashed #E6D2B5;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #8C6A3B;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.card-note i {
    margin-top: 0.2rem;
}

/* Step Progress Tracker */
.tracker-container {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tracker-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.tracker-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 0 0.5rem;
    margin: 1.8rem 0 0.5rem 0;
}

.tracker-line-bg {
    position: absolute;
    top: 15px;
    left: 8%;
    right: 8%;
    height: 4px;
    background-color: #EFE9DF;
    z-index: 1;
}

.tracker-line-fill {
    position: absolute;
    top: 15px;
    left: 8%;
    width: var(--fill-size, 0%);
    height: 4px;
    background-color: var(--primary);
    z-index: 2;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.tracker-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 3;
    width: 80px;
}

.step-bubble {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: #FFFFFF;
    border: 3px solid #EFE9DF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #B2A6A5;
    transition: all 0.4s ease;
}

.step-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.6rem;
    text-align: center;
    white-space: normal;
    word-break: keep-all;
    max-width: 90px;
    line-height: 1.25;
    transition: color 0.4s ease;
}

/* Active and Completed States in Tracker */
.tracker-step.active .step-bubble {
    border-color: var(--primary);
    background-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 5px rgba(234, 160, 162, 0.2);
}

.tracker-step.active .step-label {
    color: var(--primary-dark);
    font-weight: 500;
}

.tracker-step.completed .step-bubble {
    border-color: var(--primary);
    background-color: var(--bg-card);
    color: var(--primary);
}

.tracker-step.completed .step-label {
    color: var(--text-main);
}

/* Footer Section */
.shop-footer {
    text-align: center;
    padding-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    animation: fadeIn 0.8s ease-out 0.6s both;
}

.footer-divider {
    height: 1px;
    background-color: var(--border-color);
    width: 80%;
    margin: 0 auto 1rem auto;
}

.footer-copyright {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--primary-dark);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Styles */
@media (max-width: 600px) {
    .app-container {
        padding: 1.5rem 1rem;
        gap: 1.5rem;
    }
    
    .shop-title {
        font-size: 1.8rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .search-card {
        padding: 1.2rem;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .search-btn {
        padding: 0.8rem;
        justify-content: center;
    }
    
    .card-details {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .tracker-steps {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.8rem;
        padding: 0.5rem 0 0.5rem 0.5rem;
        margin: 1.5rem 0 0.5rem 0;
        position: relative;
    }
    
    .tracker-line-bg {
        top: 20px;
        bottom: 20px;
        left: 21px;
        width: 4px;
        height: calc(100% - 40px);
        right: auto;
    }
    
    .tracker-line-fill {
        top: 20px;
        left: 21px;
        width: 4px;
        height: var(--fill-size, 0%);
        transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
        width: 4px;
    }
    
    .tracker-step {
        flex-direction: row;
        align-items: center;
        gap: 1.2rem;
        width: 100%;
        text-align: left;
    }
    
    .step-label {
        margin-top: 0;
        text-align: left;
        max-width: none;
        white-space: normal;
        font-size: 0.8rem;
    }
}
