/**
 * Coffee App - The Morning Ritual
 * Warm, crafty, inviting. Like a neighborhood coffee shop menu board.
 * @version 9.0.0
 */

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

.app-coffee {
    --coffee-accent: #7c3aed;
    --coffee-accent-hover: #6d28d9;
    --coffee-accent-light: #a78bfa;
    --coffee-star: #E8A838;
    --coffee-star-muted: #d4d0cc;
    --coffee-border: rgb(124 58 237 / 12%);
    --coffee-tint: rgb(124 58 237 / 5%);
    --coffee-text-primary: #333;
    --app-star: var(--coffee-star);
}

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

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

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

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

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

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

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

/* =============================================================================
   COFFEE CAROUSEL
   ============================================================================= */

.carousel-section {
    width: 100%;
}

.carousel-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 8px;
    scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

.carousel-card {
    flex: 0 0 140px;
    scroll-snap-align: start;
    background: rgb(255 255 255 / 75%);
    border: 1.5px solid var(--coffee-border);
    border-radius: 14px;
    padding: 14px 12px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.carousel-card:hover {
    border-color: var(--coffee-accent);
    background: rgb(255 255 255 / 90%);
    box-shadow: 0 2px 12px rgb(124 58 237 / 10%);
    transform: translateY(-2px);
}

.carousel-card:active {
    transform: translateY(0);
}

.carousel-card__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--coffee-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.carousel-card__brand {
    font-size: 11px;
    color: var(--coffee-accent-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.carousel-card__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.carousel-card__roast {
    font-size: 10px;
    font-weight: 600;
    color: var(--coffee-accent-light);
    background: var(--coffee-tint);
    border: 1px solid rgb(124 58 237 / 12%);
    border-radius: 10px;
    padding: 2px 7px;
    line-height: 1.3;
}

.carousel-card__rating {
    font-size: 11px;
    color: var(--coffee-star);
    letter-spacing: -1px;
}

.carousel-card__edit {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: rgb(255 255 255 / 80%);
    border: 1px solid rgb(124 58 237 / 12%);
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.carousel-card:hover .carousel-card__edit {
    opacity: 1;
}

.carousel-card__edit:hover {
    background: var(--coffee-tint);
    border-color: var(--coffee-accent);
}

/* Add-new card */
.carousel-card--add {
    align-items: center;
    justify-content: center;
    border-style: dashed;
    min-height: 90px;
    gap: 4px;
}

.carousel-card--add:hover {
    border-style: dashed;
}

.carousel-card--add-icon {
    font-size: 24px;
    color: var(--coffee-accent-light);
    line-height: 1;
}

.carousel-card--add-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--coffee-accent-light);
    text-align: center;
}

/* Empty state */
.carousel-empty {
    text-align: center;
    padding: 16px;
}

.carousel-empty-text {
    font-size: 13px;
    color: var(--coffee-accent-light);
    margin-bottom: 12px;
}

/* =============================================================================
   CONFIRMATION DIALOG
   ============================================================================= */

.confirm-dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 40%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}

.confirm-dialog {
    background: #fefbff;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgb(124 58 237 / 20%);
    border: 1px solid var(--coffee-border);
    padding: 28px 24px 20px;
    max-width: 320px;
    width: 100%;
    animation: slideUp 0.2s ease;
}

.confirm-dialog-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
}

.confirm-dialog-icon {
    font-size: 32px;
    line-height: 1;
}

.confirm-dialog-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--coffee-accent);
}

.confirm-dialog-body {
    text-align: center;
    margin-bottom: 20px;
}

.confirm-dialog__name {
    font-size: 18px;
    font-weight: 700;
    color: var(--coffee-text-primary);
}

.confirm-dialog__brand {
    font-size: 13px;
    color: var(--coffee-accent-light);
    margin-top: 2px;
}

.confirm-dialog__details {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.confirm-dialog__roast {
    font-size: 11px;
    font-weight: 600;
    color: var(--coffee-accent-light);
    background: var(--coffee-tint);
    border: 1px solid rgb(124 58 237 / 12%);
    border-radius: 10px;
    padding: 2px 8px;
}

.confirm-dialog__rating {
    font-size: 14px;
    color: var(--coffee-star);
    letter-spacing: -1px;
}

.confirm-dialog-actions {
    display: flex;
    gap: 10px;
}

.confirm-dialog-btn {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.confirm-dialog-btn--cancel {
    color: var(--coffee-accent-light);
    background: transparent;
    border: 1.5px solid rgb(124 58 237 / 15%);
}

.confirm-dialog-btn--cancel:hover {
    background: var(--coffee-tint);
    border-color: var(--coffee-accent);
    color: var(--coffee-accent);
}

.confirm-dialog-btn--log {
    color: white;
    background: var(--coffee-accent);
    border: none;
    box-shadow: 0 2px 8px rgb(124 58 237 / 20%);
}

.confirm-dialog-btn--log:hover {
    background: var(--coffee-accent-hover);
    box-shadow: 0 4px 12px rgb(124 58 237 / 28%);
}

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

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

/* =============================================================================
   FORM SECTION (collapsible)
   ============================================================================= */

.form-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 4px;
    border-top: 1.5px solid rgb(124 58 237 / 10%);
}

.form-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--coffee-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-section-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--coffee-accent-light);
    background: transparent;
    border: 1px solid rgb(124 58 237 / 12%);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.form-section-close:hover {
    background: var(--coffee-tint);
    border-color: var(--coffee-accent);
    color: var(--coffee-accent);
}

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

.input-section {
    width: 100%;
}

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

.coffee-input {
    width: 100%;
    padding: 13px 18px;
    font-size: 16px;
    border: 1.5px solid var(--coffee-border);
    border-radius: 12px;
    background: var(--color-neutral-0);
    color: var(--color-text-primary);
    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 rgb(124 58 237 / 8%);
    background: var(--color-neutral-0);
}

.coffee-input::placeholder {
    color: var(--color-neutral-400);
}

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

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

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

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

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

.roast-chip {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--coffee-accent-light);
    background: var(--coffee-tint);
    border: 1.5px solid rgb(124 58 237 / 15%);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.roast-chip:hover {
    background: rgb(124 58 237 / 10%);
    border-color: var(--coffee-accent);
    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: 12px;
    font-weight: 700;
    color: var(--coffee-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: var(--coffee-star-muted);
    background: var(--coffee-tint);
    border: 1.5px solid rgb(124 58 237 / 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(--coffee-star);
    border-color: var(--coffee-star);
    background: rgb(232 168 56 / 8%);
}

.star.selected {
    color: var(--coffee-star);
    border-color: var(--coffee-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(--coffee-accent);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgb(124 58 237 / 20%);
    -webkit-tap-highlight-color: transparent;
}

.log-button:hover:not(:disabled) {
    background: var(--coffee-accent-hover);
    box-shadow: 0 4px 16px rgb(124 58 237 / 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(--coffee-accent-light);
    background: transparent;
    border: 1.5px solid rgb(124 58 237 / 15%);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

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

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

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

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

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

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

    .roast-chip {
        padding: 7px 14px;
        font-size: 12px;
    }

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

    .carousel-card {
        flex: 0 0 125px;
    }

    .carousel-card__edit {
        opacity: 1;
    }
}

@media (min-width: 768px) {
    .coffee-container {
        max-width: 500px;
        padding: 32px;
        border-radius: 24px;
    }
}

@media (min-width: 1024px) {
    .coffee-container {
        max-width: 560px;
        padding: 40px;
    }
}

/* =============================================================================
   REDUCED MOTION
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    .coffee-input,
    .roast-chip,
    .star,
    .log-button,
    .cancel-button,
    .carousel-card,
    .carousel-card__edit,
    .confirm-dialog-backdrop,
    .confirm-dialog,
    .confirm-dialog-btn,
    .form-section-close {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
