/**
 * Coffee App - Aligned with Site Theme
 * Card-based design matching apps page aesthetic
 * @version 7.0.0
 */

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

.app-coffee {
    --coffee-accent: #6F4E37;
    --coffee-accent-light: #8B6914;
    --coffee-accent-dark: #5C3A1E;
    --coffee-star: #F59E0B;
}

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

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

.coffee-container {
    background: linear-gradient(180deg, #FFF8F0 0%, #F5E6D3 100%);
    border-radius: 16px;
    box-shadow: 0 5px 15px rgb(0 0 0 / 10%);
    border: 1px solid rgb(111 78 55 / 15%);
    padding: 32px 24px;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* =============================================================================
   COFFEE ICON
   ============================================================================= */

.coffee-icon {
    font-size: 56px;
    line-height: 1;
}

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

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

.input-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--coffee-accent);
    margin-bottom: 10px;
}

.coffee-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 1px solid rgb(111 78 55 / 20%);
    border-radius: 8px;
    background: white;
    color: #222;
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.coffee-input:focus {
    outline: none;
    border-color: var(--coffee-accent);
    box-shadow: 0 0 0 3px rgba(111, 78, 55, 0.1);
    background: white;
}

.coffee-input::placeholder {
    color: #999;
}

.input-hint {
    font-size: 13px;
    color: #767676;
    margin-top: 8px;
}

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

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

.recent-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.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(--coffee-accent);
    background: white;
    border: 1px solid rgb(111 78 55 / 20%);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

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

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

/* =============================================================================
   ROAST SELECTION
   ============================================================================= */

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

.roast-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.roast-chips {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.roast-chip {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #57534E;
    background: white;
    border: 1px solid rgb(111 78 55 / 20%);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.roast-chip:hover {
    border-color: var(--coffee-accent);
}

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

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

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

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

.rating-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

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

.star {
    width: 44px;
    height: 44px;
    font-size: 24px;
    color: #ccc;
    background: white;
    border: 1px solid rgb(111 78 55 / 20%);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.star:hover {
    border-color: var(--coffee-star);
    color: var(--coffee-star);
}

.star.selected {
    color: var(--coffee-star);
    border-color: var(--coffee-star);
    background: #FFFBEB;
}

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

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

.log-button {
    width: 100%;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: #222;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
    -webkit-tap-highlight-color: transparent;
}

.log-button:hover:not(:disabled) {
    background: #444;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
}

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

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

.cancel-button {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: 1px solid rgb(0 0 0 / 12%);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cancel-button:hover {
    background: #fafafa;
    border-color: #222;
    color: #222;
}

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

.today-count {
    font-size: 14px;
    color: #666;
    padding: 10px 20px;
    background: #fafafa;
    border-radius: 50px;
    border: 1px solid rgb(0 0 0 / 8%);
}

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

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

.toast {
    padding: 12px 24px;
    border-radius: 8px;
    background: #222;
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgb(0 0 0 / 20%);
    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;
}

.toast-error {
    background: #ef4444;
}

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

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

.history-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #222;
    background: #fafafa;
    border: 1px solid rgb(0 0 0 / 12%);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-toggle:hover {
    background: white;
    border-color: #222;
}

.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: 14px 16px;
    background: #fafafa;
    border: 1px solid rgb(0 0 0 / 8%);
    border-radius: 8px;
    margin-bottom: 8px;
}

.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: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

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

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

.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(0 0 0 / 12%);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.history-action-btn:hover {
    background: white;
    border-color: #222;
}

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

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

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

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

    .coffee-container {
        padding: 24px 20px;
        gap: 20px;
    }

    .coffee-icon {
        font-size: 48px;
    }

    .star {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }

    .roast-chip {
        padding: 8px 16px;
        font-size: 13px;
    }
}
