/* ==========================================
   English Food Ordering - Main Stylesheet
   Bright, playful design for young learners
   ========================================== */

/* ==================== Variables ==================== */
:root {
    /* Rainbow candy colors */
    --primary-red: #FF6B6B;
    --primary-orange: #FFA07A;
    --primary-yellow: #FFE66D;
    --primary-green: #95E1D3;
    --primary-blue: #4ECDC4;
    --primary-purple: #DDA0DD;
    --primary-pink: #FFB6C1;

    /* Background gradients */
    --bg-gradient: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);

    /* Functional colors */
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #F44336;

    /* Shadows */
    --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shadow-bounce: 0 10px 30px rgba(0, 0, 0, 0.2);

    /* Border radius */
    --radius-small: 12px;
    --radius-medium: 20px;
    --radius-large: 30px;
    --radius-round: 50%;
}

/* ==================== Base Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Microsoft YaHei', 'Segoe UI', sans-serif;
    min-height: 100vh;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: #333;
    line-height: 1.6;
}

/* Background decorations */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(78, 205, 196, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 50% 50%, rgba(255, 230, 109, 0.05) 0%, transparent 30%);
    pointer-events: none;
    z-index: -1;
}

/* ==================== Typography ==================== */
h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4, #FFE66D, #DDA0DD);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 5s ease infinite;
}

h2 {
    font-size: 1.8rem;
    color: #555;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.3rem;
    color: #666;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ==================== Container ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.page-header {
    text-align: center;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-soft);
    margin-bottom: 30px;
}

.page-header .subtitle {
    font-size: 1.2rem;
    color: #888;
    margin-top: 10px;
}

/* ==================== Team Cards ==================== */
.team-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.team-card {
    background: white;
    border-radius: var(--radius-medium);
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-soft);
    border: 4px solid transparent;
    position: relative;
    overflow: hidden;
}

.team-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--card-color);
    transition: height 0.3s ease;
}

.team-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-bounce);
}

.team-card.selected {
    border-color: var(--card-color);
    transform: translateY(-5px);
}

.team-card.selected::before {
    height: 10px;
}

.team-card .team-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
    display: block;
}

.team-card .team-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
}

.team-card .team-status {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #888;
}

.team-card.selected .team-status {
    color: var(--card-color);
    font-weight: bold;
}

/* ==================== Menu Section ==================== */
.menu-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-large);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-soft);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px dashed #eee;
}

.category-icon {
    font-size: 3rem;
}

.category-title {
    font-size: 1.5rem;
    color: #444;
    font-weight: bold;
}

.category-sentence-hint {
    margin-left: auto;
    font-size: 0.9rem;
    color: #FF6B6B;
    font-style: italic;
}

/* ==================== Sentence Area ==================== */
.sentence-area {
    background: linear-gradient(135deg, #FFF0F5 0%, #FFE4E1 100%);
    border-radius: var(--radius-medium);
    padding: 20px 25px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid var(--primary-pink);
    box-shadow: var(--shadow-soft);
}

.sentence-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.sentence-text {
    font-size: 1.2rem;
    color: #DDA0DD;
    font-style: italic;
    line-height: 1.6;
}

/* ==================== Menu Grid ==================== */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.menu-item {
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    border-radius: var(--radius-medium);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-soft);
    border: 3px solid transparent;
    position: relative;
}

.menu-item:hover {
    transform: translateY(-5px) rotate(-2deg);
    box-shadow: var(--shadow-medium);
}

.menu-item.selected {
    border-color: var(--success-color);
    background: linear-gradient(145deg, #e8f5e9, #c8e6c9);
    transform: scale(1.05);
}

.menu-item.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: var(--shadow-soft);
}

.menu-item .item-emoji {
    font-size: 3.5rem;
    margin-bottom: 10px;
    display: block;
}

.menu-item .item-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.menu-item .item-price {
    font-size: 1.1rem;
    color: #FF6B6B;
    font-weight: bold;
}

.menu-item .quantity-badge {
    position: absolute;
    top: -10px;
    left: -10px;
    background: var(--primary-red);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: var(--shadow-soft);
    animation: pulse 1s infinite;
}

.menu-item .quantity-badge.show {
    display: flex;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==================== Order Bar ==================== */
.order-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 20px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    border-top-left-radius: var(--radius-large);
    border-top-right-radius: var(--radius-large);
}

.order-bar .order-summary {
    display: flex;
    align-items: center;
    gap: 20px;
}

.order-bar .cart-icon {
    font-size: 2.5rem;
    position: relative;
}

.order-bar .cart-count {
    position: absolute;
    top: -5px;
    right: -10px;
    background: var(--primary-red);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
}

.order-bar .order-text {
    font-size: 1.2rem;
    color: #666;
}

.order-bar .order-text strong {
    color: var(--primary-red);
    font-size: 1.5rem;
}

.order-bar .btn {
    padding: 15px 40px;
    font-size: 1.3rem;
    border: none;
    border-radius: var(--radius-large);
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.order-bar .btn-submit {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.order-bar .btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.5);
}

.order-bar .btn-submit:active {
    transform: translateY(0);
}

.order-bar .btn-clear {
    background: #f5f5f5;
    color: #888;
    margin-right: 15px;
}

.order-bar .btn-clear:hover {
    background: #eee;
    color: #666;
}

.order-bar .btn-back {
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    color: #666;
    margin-right: 15px;
    padding: 10px 20px;
    font-size: 1rem;
}

.order-bar .btn-back:hover {
    background: linear-gradient(135deg, #e0e0e0, #d0d0d0);
    color: #333;
}

/* ==================== Teacher Page ==================== */
.teacher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.team-order-card {
    background: white;
    border-radius: var(--radius-large);
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    transition: all 0.3s ease;
}

.team-order-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-bounce);
}

.team-order-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.team-order-header .team-emoji {
    font-size: 3rem;
}

.team-order-header .team-name {
    font-size: 1.5rem;
    font-weight: bold;
}

.team-order-header .order-count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.3);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 1rem;
}

.team-order-body {
    padding: 20px;
    min-height: 150px;
}

.team-order-empty {
    text-align: center;
    color: #aaa;
    padding: 30px;
    font-size: 1.1rem;
}

.order-items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.order-item-tag {
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    animation: pop-in 0.3s ease;
}

.order-item-tag .item-emoji {
    font-size: 1.5rem;
}

.order-item-tag .item-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.order-item-tag .item-english {
    font-size: 0.95rem;
    color: #333;
    font-weight: 600;
}

.order-item-tag .item-chinese {
    font-size: 0.85rem;
    color: #777;
}

@keyframes pop-in {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.refresh-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 10px 20px;
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #666;
}

.refresh-indicator .dot {
    width: 12px;
    height: 12px;
    background: var(--success-color);
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.reset-btn-container {
    text-align: center;
    margin-top: 30px;
}

.reset-btn {
    background: linear-gradient(135deg, #F44336, #e53935);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: var(--radius-large);
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    box-shadow: 0 5px 15px rgba(244, 67, 54, 0.4);
    transition: all 0.3s ease;
}

.reset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(244, 67, 54, 0.5);
}

/* ==================== Modal ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-large);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: modal-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #333;
}

.modal-text {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 25px;
}

.modal-btn {
    background: linear-gradient(135deg, #4ECDC4, #44a8a0);
    color: white;
    border: none;
    padding: 15px 50px;
    font-size: 1.3rem;
    border-radius: var(--radius-large);
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    transform: scale(1.05);
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: white;
    padding: 15px 30px;
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-medium);
    z-index: 300;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-left: 5px solid var(--success-color);
}

.toast.error {
    border-left: 5px solid var(--danger-color);
}

.toast.warning {
    border-left: 5px solid var(--warning-color);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    .team-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    .menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .order-bar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .order-bar .btn {
        width: 100%;
        padding: 12px 30px;
        font-size: 1.1rem;
    }

    .teacher-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== Loading ==================== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== No Team Selected ==================== */
.no-team-selected {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-soft);
}

.no-team-selected .icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.no-team-selected .text {
    font-size: 1.5rem;
    color: #888;
}

.main-content {
    padding-bottom: 120px;
}

/* ==================== Random Combo Button ==================== */
.random-btn {
    background: linear-gradient(135deg, #FF6B6B, #FFA07A);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: var(--radius-large);
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
    transition: all 0.3s ease;
    margin-left: 15px;
}

.random-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5);
}

.reset-btn-container button {
    margin: 0 8px;
}

/* ==================== Random Combo Modal ==================== */
.random-combo-content {
    max-width: 700px;
    padding: 30px;
}

.random-combo-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px dashed #eee;
}

.random-combo-content .modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    color: #FF6B6B;
}

.modal-close {
    background: #f5f5f5;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.modal-close:hover {
    background: #FF6B6B;
    color: white;
}

.random-combo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.random-combo-item {
    background: linear-gradient(145deg, #fff, #f8f8f8);
    border-radius: 15px;
    padding: 15px;
    border: 2px solid #eee;
    transition: all 0.3s ease;
}

.random-combo-item:hover {
    border-color: #FF6B6B;
    transform: scale(1.02);
}

.combo-category {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee;
}

.combo-item-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.combo-emoji {
    font-size: 3rem;
}

.combo-info {
    text-align: left;
}

.combo-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.combo-english {
    font-size: 1rem;
    color: #666;
    font-style: italic;
}

.random-combo-content .modal-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #eee;
}

.btn-primary {
    background: linear-gradient(135deg, #4ECDC4, #44a8a0);
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 1.1rem;
    border-radius: var(--radius-large);
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: scale(1.05);
}
