/**
 * Tea App - The Tea Ritual
 * Serene, meditative, gentle. Like a quiet afternoon with a warm cup.
 * @version 8.0.0
 */

/* =============================================================================
   THEME VARIABLES
   ============================================================================= */

.app-tea {
    --tea-accent: #4A7C59;
    --tea-accent-hover: #3A6347;
    --tea-accent-light: #6B9E7A;
    --tea-star: #E8A838;
    --tea-border: rgb(74 124 89 / 12%);
    --tea-tint: rgb(74 124 89 / 5%);
}

/* =============================================================================
   BASE LAYOUT
   ============================================================================= */

.tea-main {
    min-height: 100vh;
    background-color: #F7FAF7;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 20px 40px;
}

.tea-container {
    background: linear-gradient(180deg, #F5FAF5 0%, #E2EFE2 100%);
    border-radius: 20px;
    box-shadow: 0 4px 24px rgb(74 124 89 / 8%);
    border: 1px solid var(--tea-border);
    padding: 36px 28px 32px;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* =============================================================================
   GREETING HEADER
   ============================================================================= */

.tea-greeting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.tea-icon {
    font-size: 48px;
    line-height: 1;
}

.tea-greeting-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--tea-accent);
    letter-spacing: -0.3px;
}

/* =============================================================================
   INPUT SECTIONS
   ============================================================================= */

.input-section {
    width: 100%;
}

.input-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--tea-accent-light);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.tea-input {
    width: 100%;
    padding: 13px 18px;
    font-size: 16px;
    border: 1.5px solid var(--tea-border);
    border-radius: 12px;
    background: white;
    color: #333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tea-input:focus {
    outline: none;
    border-color: var(--tea-accent);
    box-shadow: 0 0 0 3px rgb(74 124 89 / 8%);
    background: white;
}

.tea-input::placeholder {
    color: #bbb;
}

/* Hide hint text — placeholders are enough */
.input-hint {
    display: none;
}

/* =============================================================================
   TYPE SELECTION — the soul of tea, elevated
   ============================================================================= */

.type-section {
    width: 100%;
    text-align: center;
}

.type-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--tea-accent-light);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.type-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.type-chip {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tea-accent);
    background: var(--tea-tint);
    border: 1.5px solid rgb(74 124 89 / 15%);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    gap: 5px;
}

.type-emoji {
    font-size: 16px;
}

.type-chip:hover {
    background: rgb(74 124 89 / 10%);
    border-color: var(--tea-accent);
}

.type-chip.selected {
    background: var(--tea-accent);
    border-color: var(--tea-accent);
    color: white;
}

.type-chip.locked {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* =============================================================================
   STAR RATING
   ============================================================================= */

.rating-section {
    width: 100%;
    text-align: center;
}

.rating-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--tea-accent-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.star {
    width: 42px;
    height: 42px;
    font-size: 22px;
    color: #c8d4ca;
    background: var(--tea-tint);
    border: 1.5px solid rgb(74 124 89 / 12%);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.star:hover {
    color: var(--tea-star);
    border-color: var(--tea-star);
    background: rgb(232 168 56 / 8%);
}

.star.selected {
    color: var(--tea-star);
    border-color: var(--tea-star);
    background: rgb(232 168 56 / 10%);
}

/* =============================================================================
   ACTION BUTTONS
   ============================================================================= */

.action-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.log-button {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: var(--tea-accent);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgb(74 124 89 / 20%);
    -webkit-tap-highlight-color: transparent;
}

.log-button:hover:not(:disabled) {
    background: var(--tea-accent-hover);
    box-shadow: 0 4px 16px rgb(74 124 89 / 28%);
    transform: translateY(-1px);
}

.log-button:active:not(:disabled) {
    transform: translateY(0);
}

.log-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.cancel-button {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--tea-accent-light);
    background: transparent;
    border: 1.5px solid rgb(74 124 89 / 15%);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cancel-button:hover {
    background: var(--tea-tint);
    border-color: var(--tea-accent);
    color: var(--tea-accent);
}

/* =============================================================================
   TODAY'S COUNT
   ============================================================================= */

.today-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--tea-accent);
    padding: 8px 20px;
    background: var(--tea-tint);
    border-radius: 20px;
    border: 1px solid rgb(74 124 89 / 10%);
}

/* =============================================================================
   TOAST NOTIFICATIONS
   ============================================================================= */

.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.toast {
    padding: 12px 24px;
    border-radius: 12px;
    background: var(--tea-accent);
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgb(74 124 89 / 25%);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #10b981;
    box-shadow: 0 4px 20px rgb(16 185 129 / 25%);
}

.toast-error {
    background: #ef4444;
    box-shadow: 0 4px 20px rgb(239 68 68 / 25%);
}

/* =============================================================================
   HISTORY SECTION
   ============================================================================= */

.history-section {
    width: 100%;
    margin-top: 4px;
}

.history-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tea-accent);
    background: transparent;
    border: 1.5px dashed rgb(74 124 89 / 20%);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-toggle:hover {
    background: var(--tea-tint);
    border-color: var(--tea-accent);
}

.history-toggle[aria-expanded="true"] .history-toggle-icon {
    transform: rotate(180deg);
}

.history-toggle-icon {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.history-list {
    display: none;
    margin-top: 12px;
}

.history-list.expanded {
    display: block;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgb(255 255 255 / 60%);
    border: 1px solid rgb(74 124 89 / 8%);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: background 0.15s ease;
}

.history-item:hover {
    background: rgb(255 255 255 / 80%);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-details {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 12px;
    color: #888;
}

.history-item-rating {
    color: var(--tea-star);
}

.history-item-time {
    color: #aaa;
}

.history-item-actions {
    display: flex;
    gap: 4px;
    margin-left: 12px;
}

.history-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: transparent;
    border: 1px solid rgb(74 124 89 / 10%);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.history-action-btn:hover {
    background: rgb(255 255 255 / 80%);
    border-color: var(--tea-accent);
}

.history-action-btn--delete:hover {
    background: #FEE2E2;
    border-color: #EF4444;
}

.history-empty {
    text-align: center;
    padding: 20px;
    color: #bbb;
    font-size: 14px;
    font-style: italic;
}

/* =============================================================================
   RECENT CHIPS
   ============================================================================= */

.recent-section {
    width: 100%;
    text-align: center;
}

.recent-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--tea-accent-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.recent-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.recent-chip {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--tea-accent);
    background: white;
    border: 1.5px solid rgb(74 124 89 / 15%);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.recent-chip:hover {
    background: var(--tea-tint);
    border-color: var(--tea-accent);
}

.recent-chip:active {
    transform: scale(0.96);
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 480px) {
    .tea-main {
        padding: 76px 16px 32px;
    }

    .tea-container {
        padding: 28px 20px 24px;
        gap: 18px;
        border-radius: 16px;
    }

    .tea-icon {
        font-size: 40px;
    }

    .star {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }

    .type-chip {
        padding: 8px 14px;
        font-size: 13px;
    }

    .type-chips {
        gap: 6px;
    }

    .log-button {
        border-radius: 12px;
        padding: 14px;
    }
}
