@import url('https://fonts.googleapis.com/css2?family=Playwrite+NO&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.playwrite-no {
    font-family: "Playwrite NO", cursive;
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
}

:root {
    /* M3 Color System - Green Theme */
    --md-sys-color-primary: #2E7D32;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #A5D6A7;
    --md-sys-color-on-primary-container: #002105;

    --md-sys-color-on-primary-bg:#fdfdfd;
    --md-sys-color-on-primary-bg2:#e5e5e5;
    
    --md-sys-color-secondary: #558B2F;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #DCEDC8;
    --md-sys-color-on-secondary-container: #131F03;
    
    --md-sys-color-tertiary: #00695C;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #B2DFDB;
    --md-sys-color-on-tertiary-container: #001F1B;

    --md-sys-color-error: #BA1A1A;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #FFDAD6;
    --md-sys-color-on-error-container: #410002;

    --md-sys-color-background: #FFFFFF;
    --md-sys-color-on-background: #1A1C18;
    
    --md-sys-color-surface: #FFFFFF;
    --md-sys-color-on-surface: #1A1C18;
    --md-sys-color-surface-variant: #ffffff;
    --md-sys-color-on-surface-variant: #44483D;
    
    --md-sys-color-outline: #74796D;
    --md-sys-color-outline-variant: #C4C8BB;

    /* Custom Tonal Colors */
    --md-sys-color-warning-container: #FFECB3;
    --md-sys-color-on-warning-container: #3E2723;
    --md-sys-color-info-container: #B2EBF2;
    --md-sys-color-on-info-container: #006064;

    /* Legacy mappings for compatibility */
    --primary-color: var(--md-sys-color-primary);
    --secondary-color: var(--md-sys-color-secondary);
    --warning-color: #FF9800;
    --danger-color: var(--md-sys-color-error);
    --success-color: #4CAF50;
    --bg-color: var(--md-sys-color-background);
    --card-bg: #ffffff; /* Keep white for cards for now, or use surface */
    --text-primary: var(--md-sys-color-on-surface);
    --text-secondary: var(--md-sys-color-on-surface-variant);
    --border-color: var(--md-sys-color-outline-variant);
    
    /* M3 Elevation Shadows */
    --md-sys-elevation-1: 0px 1px 2px 0px rgba(0,0,0,0.3), 0px 1px 3px 1px rgba(0,0,0,0.15);
    --md-sys-elevation-2: 0px 1px 2px 0px rgba(0,0,0,0.3), 0px 2px 6px 2px rgba(0,0,0,0.15);
    --md-sys-elevation-3: 0px 1px 3px 0px rgba(0,0,0,0.3), 0px 4px 8px 3px rgba(0,0,0,0.15);
    
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Montserrat', sans-serif; /*Montserrat*/
}



[data-theme="dark"] {
    /* M3 Color System - Green Theme (Dark) */
    --md-sys-color-primary: #9CD67D;
    --md-sys-color-on-primary: #00390A;
    --md-sys-color-primary-container: #135218;
    --md-sys-color-on-primary-container: #B8F397;

    --md-sys-color-on-primary-bg:#1A1C18;
    --md-sys-color-on-primary-bg2:#44483D;
    
    --md-sys-color-secondary: #BCCD9E;
    --md-sys-color-on-secondary: #273500;
    --md-sys-color-secondary-container: #3D4C19;
    --md-sys-color-on-secondary-container: #D8E9B9;
    
    --md-sys-color-tertiary: #4DB6AC;
    --md-sys-color-on-tertiary: #003730;
    --md-sys-color-tertiary-container: #005045;
    --md-sys-color-on-tertiary-container: #70F7E6;

    --md-sys-color-error: #FFB4AB;
    --md-sys-color-on-error: #690005;
    --md-sys-color-error-container: #93000A;
    --md-sys-color-on-error-container: #FFDAD6;

    --md-sys-color-background: #1A1C18;
    --md-sys-color-on-background: #E3E3DC;
    
    --md-sys-color-surface: #1A1C18;
    --md-sys-color-on-surface: #E3E3DC;
    --md-sys-color-surface-variant: #44483D;
    --md-sys-color-on-surface-variant: #C4C8BB;
    
    --md-sys-color-outline: #8E9286;
    --md-sys-color-outline-variant: #44483D;

    /* Custom Tonal Colors (Dark) */
    --md-sys-color-warning-container: #5D4037;
    --md-sys-color-on-warning-container: #FFECB3;
    --md-sys-color-info-container: #004D40;
    --md-sys-color-on-info-container: #B2EBF2;

    /* Legacy mappings update */
    --card-bg: var(--md-sys-color-surface);
}

/* Font Size Classes applied to html element */
html.font-small {
    font-size: 12px;
}

html.font-medium {
    font-size: 14px;
}

html.font-large {
    font-size: 16px; /* Default browser size */
}

body {
    background-color: var(--md-sys-color-on-primary-bg);
    background-image:radial-gradient(circle, var(--md-sys-color-on-primary-bg2) 1px, transparent 1.5px);
    background-size: 16px 16px;
    
    height:100vh;
    font-family: var(--font-body);
    font-weight: 400;
    min-height: 100vh;
    padding: 20px;
    /*background: var(--md-sys-color-background);
    min-height: 100vh;
    padding: 20px;
    color: var(--md-sys-color-on-background);*/
}

.container {
    
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 80px; /* Space for fixed footer */
}

/* Header Layout */
header {
    margin-bottom: 15px;
    color: var(--md-sys-color-on-surface);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.auth-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.user-info-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem; /* Label Large */
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    padding: 4px 12px;
    border-radius: 20px;
    /* backdrop-filter removed as we are solid now */
}

.user-email {
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    font-family: var(--font-body);
    transition: transform 0.2s;
    color: var(--md-sys-color-on-surface-variant);
}

.btn-icon:hover {
    transform: rotate(45deg);
    color: var(--md-sys-color-primary);
}

.btn-text {
    background: none;
    border: none;
    color: var(--md-sys-color-primary);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.875rem;
    padding: 0;
    font-weight: 500;
}

.btn-text:hover {
    text-decoration: underline;
}

.credits-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.credits-bar {
    background: transparent;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: none;
}

.credit-badge {
    display: flex;
    align-items: center;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    padding: 6px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
}

.credit-badge .icon {
    margin-right: 8px;
    font-size: 1.1rem;
}

.btn-buy-credits {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--md-sys-elevation-1);
    transition: all 0.2s ease;
}

.btn-buy-credits.light-shade {
    background: #FFE082;
    color: #5d4037;
}

.btn-buy-credits:hover {
    transform: translateY(-1px);
    box-shadow: var(--md-sys-elevation-2);
    filter: brightness(1.05);
}

.header-main {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-logo {
    width: 200px;
    height: auto;
    object-fit: contain;
    /* filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2)); removed for cleaner look */
    background: transparent;
}

/* M3 Elevated Card */
.card {
    background: var(--md-sys-color-surface);
    border-radius: 12px; /* Medium shape */
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--md-sys-elevation-1);
    transition: box-shadow 0.2s ease;
    color: var(--md-sys-color-on-surface);
}

.card:hover {
    box-shadow: var(--md-sys-elevation-2);
}

.card h2 {
    font-family: var(--font-heading);
    font-size: 1.375rem; /* Headline Small */
    margin-bottom: 20px;
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
    font-style: normal; /* Removed italic for cleaner M3 look */
}

/* Language Selector */
.language-selector {
    margin-top: 15px;
}

.language-selector label {
    display: block;
    margin-bottom: 4px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
    font-size: 0.75rem; /* Label Small */
}

.language-select {
    width: 100%;
    height: 56px;
    padding: 8px 16px;
    font-size: 1rem; /* Body Large */
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 4px; /* Small shape */
    background: transparent;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: border-color 0.2s ease;
    font-family: var(--font-body);
    box-sizing: border-box;
}

.language-select:hover {
    border-color: var(--md-sys-color-on-surface); /* Hover state */
}

.language-select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 7px 15px; /* Adjust padding to prevent layout shift */
}

/* Language Grid */
.language-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .language-grid {
        grid-template-columns: 1fr;
    }
}

/* Recording Status */
.recording-status {
    text-align: center;
    margin-bottom: 30px;
}

.timer {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
    margin-bottom: 10px;
}

.status-indicator {
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: 8px 20px;
    background: var(--bg-color);
    border-radius: 20px;
    display: inline-block;
}

.status-indicator.recording {
    background: #ffebee;
    color: var(--danger-color);
    animation: pulse 2s infinite;
}

.status-indicator.paused {
    background: #fff3e0;
    color: var(--warning-color);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

/* Controls */
.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* Material Design 3 Button Styles */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 64px;
    border: none;
    outline: none;
    line-height: inherit;
    user-select: none;
    -webkit-appearance: none;
    overflow: hidden;
    vertical-align: middle;
    background: transparent;
    
    /* M3 Specs */
    height: 40px;
    padding: 0 24px;
    border-radius: 20px; /* Fully rounded */
    font-family: var(--font-body);
    font-size: 0.875rem; /* 14px */
    font-weight: 500;
    letter-spacing: 0.1px;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s, border-color 0.2s, transform 0.1s;
    text-transform: none;
}

/* State Layer (Hover/Focus/Active) */
.btn:hover:not(:disabled) {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15); /* Elevation 1 */
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    box-shadow: none;
    transform: translateY(0);
}

.btn:disabled {
    background-color: rgba(28, 27, 31, 0.12) !important;
    color: rgba(28, 27, 31, 0.38) !important;
    box-shadow: none !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tonal Button (Primary) */
.btn-primary {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border: none;
    box-shadow: var(--md-sys-elevation-1);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-sys-elevation-2);
}

/* Tonal Button (Secondary) */
.btn-secondary {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border: none;
    box-shadow: var(--md-sys-elevation-1);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--md-sys-color-secondary);
    color: var(--md-sys-color-on-secondary);
    box-shadow: var(--md-sys-elevation-2);
}

/* Tonal Button (Warning) */
.btn-warning {
    background-color: var(--md-sys-color-warning-container);
    color: var(--md-sys-color-on-warning-container);
    border: none;
    box-shadow: var(--md-sys-elevation-1);
}

.btn-warning:hover:not(:disabled) {
    
    filter: brightness(0.95);
    box-shadow: var(--md-sys-elevation-2);
}

/* Tonal Button (Danger) */
.btn-danger {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    border: none;
    box-shadow: var(--md-sys-elevation-1);
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
    box-shadow: var(--md-sys-elevation-2);
}

/* Tonal Button (Success) */
.btn-success {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border: none;
    box-shadow: var(--md-sys-elevation-1);
}

.btn-success:hover:not(:disabled) {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-sys-elevation-2);
}

/* Tonal Button (Info) */
.btn-info {
    background-color: var(--md-sys-color-info-container);
    color: var(--md-sys-color-on-info-container);
    border: none;
    box-shadow: var(--md-sys-elevation-1);
}

.btn-info:hover:not(:disabled) {
    filter: brightness(0.95);
    box-shadow: var(--md-sys-elevation-2);
}

/* Small Button */
.btn-small {
    height: 32px;
    padding: 0 16px;
    font-size: 0.8rem;
}

/* Large Button */
.btn-large {
    height: 48px;
    padding: 0 32px;
    font-size: 1rem;
    border-radius: 24px;
    width: 100%;
    margin-top: 20px;
}

.icon {
    font-size: 1.2em;
}

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

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    width: 0%;
    transition: width 0.3s ease;
}

.max-duration {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f9f9f9;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #e8f5e9;
}

.upload-label {
    cursor: pointer;
    display: block;
}

.upload-label p {
    margin-top: 10px;
    color: var(--text-secondary);
}

.file-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.uploaded-file {
    margin-top: 15px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 500;
    display: none;
}

.uploaded-file.show {
    display: block;
}

/* Audio Preview */
#audioPreview {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 8px;
}

/* Loading */
.loading-card {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid var(--bg-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

#loadingMessage {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    display: none; /* Hidden as per request */
}

.loading-quotes-container {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

.loading-quote {
    font-size: 1.1rem;
    color: var(--md-sys-color-primary);
    font-weight: 300;
    font-style: italic;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    position: absolute;
}

.loading-quote.visible {
    opacity: 1;
}


/* Recipe Card */
.recipe-card {
    background: var(--md-sys-color-surface);
    max-width: 600px;
    margin: 0 auto 20px;
    padding: 24px; /* M3 Standard Padding */
    border-radius: 12px; /* M3 Medium Shape */
    box-shadow: var(--md-sys-elevation-1);
    transition: box-shadow 0.2s ease;
    color: var(--md-sys-color-on-surface);
}

.recipe-card:hover {
    box-shadow: var(--md-sys-elevation-2);
}

#recipeContent {
    background: var(--md-sys-color-surface);
    padding: 0; /* Remove inner padding as card handles it */
    border-radius: 0;
    margin-bottom: 20px;
    box-shadow: none;
    border: none;
}

.recipe-title {
    font-family: var(--font-heading);
    font-size: 2rem; /* Headline Medium */
    color: #1a1a1a;
    margin-bottom: 8px;
    text-align: center;
    font-weight: 700;
    font-style: normal;
    letter-spacing: 0;
    line-height: 1.2;
}

.recipe-author {
    color: #333333;
    font-style: normal;
    font-size: 0.875rem; /* Body Small */
    margin: 0 0 16px 0;
    text-align: center;
    font-weight: 500;
}

.recipe-description {
    text-align: center;
    color: #1a1a1a;
    font-size: 1rem; /* Body Large */
    line-height: 1.5;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--md-sys-color-surface-variant); /* Use variant background */
    border-radius: 12px;
    font-style: normal;
    font-weight: 500;
}

.recipe-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
    padding: 12px;
    background: var(--md-sys-color-secondary-container); /* Secondary Container */
    border-radius: 12px;
}

.meta-item {
    text-align: center;
    padding: 4px;
}

.meta-label {
    font-si#1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 6: 0.5px;
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

.meta-value {
    font-size: 1rem; /* Body Large */
    color: #1a1a1a;
    font-weight: 700;
    line-height: 1.2;
}

.recipe-section {
    margin-bottom: 24px;
}

.recipe-two-column {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.ingredients-column {
    grid-column: 1;
}

.recipe-two-column::after {
    content: '';
    grid-column: 2;
    background: var(--md-sys-color-outline-variant);
    width: 1px;
    margin: 0 auto;
}

.instructions-column {
    grid-column: 3;
}

.recipe-section-title {
    font-family: var(--font-heading);
    color: #1a5c1a;
    font-size: 1.25rem; /* Title Large */
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #1a5c1a;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recipe-section-title .icon {
    font-size: 1.25rem;
}

.ingredients-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ingredients-list li {
    padding: 8px 12px 8px 32px;
    margin-bottom: 4px;
    background: transparent; /* Remove background for cleaner look */
    border-radius: 4px;
    line-height: 1.5;
    position: relative;
    transition: background 0.2s ease;
    font-size: 1rem; /* Body Large */
    color: #1a1a1a;
    font-weight: 500;
}

.ingredients-list li:hover {
    background: var(--md-sys-color-surface-variant);
}

.ingredients-list li:before {
    content: "✓";
    position: absolute;
    left: 8px;
    color: var(--md-sys-color-primary);
    font-weight: bold;
    font-size: 1rem;
}

/* Two-column layout for ingredients */
.ingredients-two-column {
    column-count: 2;
    column-gap: 24px;
}

.ingredients-two-column li {
    break-inside: avoid;
    page-break-inside: avoid;
}

.instructions-list {
    counter-reset: step-counter;
    list-style: none;
    margin: 0;
    padding: 0;
}

.instructions-list li {
    counter-increment: step-counter;
    padding: 8px 12px 8px 40px;
    margin-bottom: 8px;
    background: transparent;
    border-radius: 4px;
    line-height: 1.5;
    position: relative;
    transition: background 0.2s ease;
    font-si#1a1a1a;
    font-weight: 500
    color: var(--md-sys-color-on-surface);
}

.instructions-list li:hover {
    background: var(--md-sys-color-surface-variant);
}

.instructions-list li:before {
    content: counter(step-counter);
    position: absolute;
    left: 8px;
    top: 8px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Two-column layout for instructions */
.instructions-two-column {
    column-count: 2;
    column-gap: 24px;
}

.instructions-two-column li {
    break-inside: avoid;
    page-break-inside: avoid;
}

.tips-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tips-list li {
    padding: 12px 16px 12px 40px;
    margin-bottom: 8px;
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    border-left: 4px solid var(--md-sys-color-tertiary);
    border-radius: 8px;
    line-height: 1.5;
    position: relative;
    font-size: 0.875rem;
}

.tips-list li:before {
    content: "💡";
    position: absolute;
    left: 12px;
    font-size: 1.1rem;
}

.recipe-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.recipe-actions .btn {
    flex: 1;
    min-width: 150px; /* Reduced from 200px to be closer to standard size but still fill space */
    justify-content: center;
    /* Removed background override to allow btn-primary, btn-secondary etc to work */
    /* Removed color override */
    /* Removed border override */
    /* Removed text-shadow override */
    font-weight: 600;
}

.recipe-actions .btn:hover:not(:disabled) {
    filter: brightness(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.recipe-actions .btn:active:not(:disabled) {
    filter: brightness(0.95);
}

/* Error Card */
.error-card {
    background: #ffebee;
    border-left: 4px solid var(--danger-color);
}

#errorMessage {
    color: var(--danger-color);
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Footer */
footer {
    text-align: center;
    color: white;
    margin-top: 30px;
    padding: 20px;
    opacity: 0.9;
    
}

/* Pricing Modal Styles */
.pricing-modal {
    max-width: 800px;
    width: 90%;
}

.currency-toggle {
    text-align: center;
    margin-bottom: 20px;
}

.currency-toggle select {
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 1rem;
    margin-left: 10px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.pricing-card {
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    background: white;
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.pricing-card.popular {
    border: 2px solid var(--primary-color);
    background: #f9fff9;
}

.pricing-card .badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.pricing-header h3 {
    margin-bottom: 10px;
    color: #333;
}

.pricing-header .price {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.pricing-features {
    margin-bottom: 20px;
    color: #666;
}

.pricing-features p {
    margin: 8px 0;
}

.payment-info {
    text-align: center;
    color: #888;
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.btn-block {
    width: 100%;
}

/* ===== PROFILE MODAL STYLES (Material Design) ===== */
.profile-modal {
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
}

.profile-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant, #e0e0e0);
}

.profile-section-compact {
    margin-bottom: 20px;
    padding-bottom: 16px;
}

.profile-section:last-of-type {
    border-bottom: none;
}

.profile-section-header {
    margin-bottom: 16px;
}

.profile-section-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface, #1c1b1f);
    margin-bottom: 4px;
}

.section-description {
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant, #49454f);
    margin: 0;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

.profile-form-group {
    margin-bottom: 0;
}

.profile-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant, #49454f);
    margin-bottom: 6px;
}

.profile-input,
.profile-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.95rem;
    border: 1px solid var(--md-sys-color-outline, #79747e);
    border-radius: 6px;
    background-color: var(--md-sys-color-surface, #ffffff);
    color: var(--md-sys-color-on-surface, #1c1b1f);
    transition: all 0.2s ease;
    font-family: inherit;
}

.profile-input:focus,
.profile-select:focus {
    outline: none;
    border-color: var(--primary-color, #4CAF50);
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.profile-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
    padding-right: 40px;
    appearance: none;
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
}

.profile-password-section {
    background-color: var(--md-sys-color-surface-variant, #f5f5f5);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--md-sys-color-outline-variant, #e0e0e0);
    margin-top: 20px;
}

.btn-profile-save {
    background-color: var(--primary-color, #4CAF50);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-profile-save:hover {
    background-color: #45a049;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-profile-save:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.profile-message {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

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

.profile-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.profile-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

/* Dark theme support for profile modal */
[data-theme="dark"] .profile-input,
[data-theme="dark"] .profile-select {
    background-color: var(--md-sys-color-surface-variant, #2c2c2c);
    border-color: var(--md-sys-color-outline, #938f99);
    color: var(--md-sys-color-on-surface, #e6e1e5);
}

[data-theme="dark"] .profile-section-header h3 {
    color: var(--md-sys-color-on-surface, #e6e1e5);
}

[data-theme="dark"] .profile-password-section {
    background-color: var(--md-sys-color-surface-variant, #1e1e1e);
    border-color: var(--md-sys-color-outline, #938f99);
}

[data-theme="dark"] .profile-message.success {
    background-color: #1b4332;
    color: #a7f3d0;
    border-color: #34d399;
}

[data-theme="dark"] .profile-message.error {
    background-color: #4c1d1d;
    color: #fca5a5;
    border-color: #ef4444;
}

[data-theme="dark"] .profile-label {
    color: var(--md-sys-color-on-surface-variant, #cac4d0);
}

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

    .card {
        padding: 20px;
    }

    .timer {
        font-size: 2.5rem;
    }

    .controls {
        gap: 8px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .upload-area {
        padding: 30px 20px;
    }

    .recipe-title {
        font-size: 1.5rem;
        
    }

    .recipe-meta {
        gap: 8px;
        padding: 10px;
    }

    .meta-label {
        font-size: 0.65rem;
    }

    .meta-value {
        font-size: 0.9rem;
    }

    #recipeContent {
        padding: 16px;
    }

    .recipe-section-title {
        font-size: 1.1rem;
    }

    .recipe-section {
        margin-bottom: 16px;
    }

    .recipe-two-column {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .ingredients-column {
        grid-column: 1;
    }

    .recipe-two-column::after {
        display: none;
    }

    .instructions-column {
        grid-column: 1;
    }

    .recipe-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .recipe-header-meta {
        align-items: center;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card {
        padding: 15px;
    }

    .timer {
        font-size: 2rem;
    }

    .controls {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .icon.large {
        font-size: 2.5rem;
    }

    .recipe-title {
        font-size: 1.4rem;
    }

    .recipe-meta {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 8px;
    }

    .meta-item {
        padding: 6px 2px;
    }

    .meta-label {
        font-size: 0.6rem;
    }

    .meta-value {
        font-size: 0.85rem;
    }

    #recipeContent {
        padding: 14px;
    }

    .recipe-section-title {
        font-size: 1rem;
    }

    .recipe-description {
        font-size: 0.85rem;
        padding: 8px;
    }

    .ingredients-list li,
    .instructions-list li,
    .tips-list li {
        font-size: 0.8rem;
    }

    /* Single column on mobile */
    .ingredients-two-column,
    .instructions-two-column {
        column-count: 1;
    }

    .recipe-two-column {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .ingredients-column,
    .instructions-column {
        grid-column: 1;
    }

    .recipe-two-column::after {
        display: none;
    }

    .instructions-list li:before {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
        left: 7px;
        top: 6px;
    }

    .tips-list li {
        padding: 5px 8px 5px 28px;
    }

    .recipe-actions {
        flex-direction: column;
    }

    .recipe-actions .btn {
        width: 100%;
        min-width: auto;
    }
}


/* ============================================================================
   NAVIGATION
   ============================================================================ */

.main-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 40px;
}

/* M3 Filter Chip Style for Navigation */
.nav-btn {
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    padding: 0 16px;
    height: 32px;
    border-radius: 8px; /* M3 Small shape */
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover {
    background: var(--md-sys-color-on-surface-variant);
    color: var(--md-sys-color-surface-variant);
}

.nav-btn.active {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: transparent;
    box-shadow: none;
}

.nav-btn.active .icon {
    /* Ensure icon inherits color */
}


/* ============================================================================
   GALLERY VIEW
   ============================================================================ */

.search-card {
    margin-bottom: 20px;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    pointer-events: none;
    opacity: 0.6;
}

.search-input {
    width: 100%;
    height: 56px; /* M3 Search Bar height */
    padding: 8px 48px 8px 52px; /* Adjust padding for icons */
    border: none; /* M3 Search Bar usually has no border, just elevation or background */
    background: var(--md-sys-color-surface-variant); /* Surface Variant color */
    border-radius: 28px; /* Fully rounded */
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--md-sys-color-on-surface);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
    outline: none;
    background: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-elevation-1); /* Elevate on focus */
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.search-clear-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
}

.recipe-count {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.gallery-card {
    background: var(--md-sys-color-surface);
    border-radius: 12px; /* M3 Medium shape */
    box-shadow: var(--md-sys-elevation-1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    overflow: hidden;
    position: relative;
}

.gallery-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--md-sys-elevation-3);
}

.gallery-card-thumbnail {
    width: 100%;
    height: 100%;
    min-height: 280px;
    background-color: var(--md-sys-color-surface);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    transition: transform 0.3s ease;
}

.gallery-card:hover .gallery-card-thumbnail {
    transform: scale(1.05);
}

.gallery-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}

/* Only apply dark gradient when thumbnail image exists */
.gallery-card-thumbnail.has-thumbnail .gallery-card-overlay {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.85) 100%);
}

/* Adjust text color for cards without thumbnails */
.gallery-card-thumbnail:not(.has-thumbnail) .gallery-card-title,
.gallery-card-thumbnail:not(.has-thumbnail) .gallery-card-author,
.gallery-card-thumbnail:not(.has-thumbnail) .gallery-card-tags,
.gallery-card-thumbnail:not(.has-thumbnail) .gallery-card-date {
    color: var(--md-sys-color-on-surface);
    text-shadow: none;
}

.gallery-card-header {
    margin-bottom: 8px;
}

.gallery-card-title {
    font-family: var(--font-heading);
    font-size: 1.25rem; /* Title Medium */
    color: #ffffff;
    margin: 0 0 4px 0;
    line-height: 1.3;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.gallery-card-author {
    font-size: 0.875rem; /* Label Small */
    color: rgba(255, 255, 255, 0.9);
    font-style: normal;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.gallery-card-tags {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 100px;
    padding-top: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.gallery-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 8px;
}

.gallery-card-date {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Community Like Button */
.community-like-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--md-sys-color-on-surface-variant);
    padding: 4px 8px;
    border-radius: 16px;
    transition: all 0.2s ease;
}

.community-like-btn:hover {
    background-color: var(--md-sys-color-surface-variant);
    transform: scale(1.05);
}

.community-like-btn:active {
    transform: scale(0.95);
}

.community-like-btn.liked {
    color: var(--md-sys-color-error);
}

.community-like-btn .heart-icon {
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.community-like-btn:active .heart-icon {
    animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(1.1); }
    75% { transform: scale(1.25); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state h2 {
    color: var(--text-secondary);
    margin: 20px 0 10px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}


/* ============================================================================
   MODAL
   ============================================================================ */

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background-color: var(--card-bg);
    margin: 2% auto;
    padding: 0;
    border-radius: 16px;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    background-color: var(--danger-color);
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.modal-close:hover {
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface);
    border-radius: 28px 28px 0 0; /* Match modal radius */
}

.modal-header h2 {
    margin: 0 0 15px 0;
    color: var(--md-sys-color-on-surface);
    font-family: var(--font-heading);
    font-size: 1.5rem; /* Headline Small */
    font-weight: 600;
    font-style: normal;
}

.modal-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
    position: relative;
   
}

/* Background image styling for modal body */
.modal-body.has-background-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: local;
}

.modal-body.has-background-image #modalRecipeContent {
    position: relative;
    z-index: 1;
}

.modal-body.has-background-image #modalRecipeContent::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--card-bg);
    opacity: 0.7;
    pointer-events: none;
    z-index: -1;
    border-radius: 1% 1% 0.5% 0.5%;
}

/* Ensure images in modal content have rounded corners */
.modal-body img,
#modalRecipeContent img {
    border-radius: 12px;
    max-width: 100%;
    height: auto;
    display: block;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid #f0f0f0;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    justify-content: center;
}


/* Edit mode styling */
[contenteditable="true"] {
    outline: 2px dashed var(--primary-color);
    outline-offset: 3px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

[contenteditable="true"]:focus {
    outline: 2px solid var(--primary-color);
    background: #f0fff4;
}

[contenteditable="true"]:hover {
    background: #f8f9fa;
}


/* Small spinner for buttons */
.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}


/* ============================================================================
   RESPONSIVE - GALLERY & MODAL
   ============================================================================ */

@media (max-width: 768px) {
    .main-nav {
        flex-direction: row;
        width: 100%;
    }

    .nav-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Ensure gallery cards maintain rounded corners on mobile */
    .gallery-card {
        border-radius: 12px !important;
        overflow: hidden;
    }

    .gallery-card-thumbnail {
        border-radius: 0 !important;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
        min-width: auto;
    }

    .modal-content {
        margin: 5% 10px;
        max-width: none;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .nav-btn {
        padding: 8px 15px;
        font-size: 0.85rem;
    }

    .nav-btn .icon {
        font-size: 1rem;
    }

    .gallery-card {
        border-radius: 12px !important;
        overflow: hidden;
    }

    .gallery-card-thumbnail {
        border-radius: 12px 12px 0 0 !important;
    }

    .gallery-card-title {
        font-size: 1.1rem;
    }

    .modal-close {
        right: 10px;
        top: 10px;
        font-size: 24px;
    }
}

/* ============================================================================
   AUTHENTICATION STYLES
   ============================================================================ */

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-left {
    text-align: left;
}

.header-right {
    display: flex;
    align-items: center;
}

.auth-status {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 15px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.auth-loading {
    color: white;
    font-size: 0.9rem;
}

.auth-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-email {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-settings {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    font-family: var(--font-body);
    transition: all 0.2s ease;
}

.btn-settings:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(30deg);
}

.btn-login,
.btn-logout {
    padding: 8px 20px;
    border: 2px solid white;
    background: transparent;
    color: white;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-login:hover,
.btn-logout:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Authentication Modal */
.modal-auth {
    max-width: 450px;
}

/* Landing View Styles */
.landing-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    padding: 20px 0;
    position: relative;
}

.landing-header {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.landing-title {
    font-family: var(--font-heading);
    font-weight: 900;
    font-style: italic;
    margin-bottom: 10px;
    color: var(--md-sys-color-on-background);
}

.landing-description {
    font-size: 1.1rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 25px;
    max-width: 500px;
}

/* Auth Card M3 */
.auth-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    text-align: left;
    /* Background handled by .card class */
}

/* M3 Segmented Button (Tabs) */
.auth-tabs {
    font-family: var(--font-body);
    display: flex;
    gap: 0;
    margin-bottom: 25px;
    background: transparent;
    padding: 0;
    border-radius: 20px;
    border: 1px solid var(--md-sys-color-outline);
    overflow: hidden;
}

.auth-tab {
    font-family: var(--font-body);
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--md-sys-color-outline);
    border-radius: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab:last-child {
    border-right: none;
}

.auth-tab:hover {
    background: var(--md-sys-color-surface-variant);
}

.auth-tab.active {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    box-shadow: none;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input {
    height: 56px;
    padding: 8px 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 4px;
    font-size: 1rem;
    font-family: var(--font-body);
    background: transparent;
    color: var(--md-sys-color-on-surface);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 7px 15px; /* Adjust for border width */
}

.form-group small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.auth-error {
    padding: 12px 15px;
    background: #ffebee;
    color: #c62828;
    border-radius: 8px;
    font-size: 0.9rem;
    border-left: 4px solid #c62828;
}

.auth-success {
    padding: 12px 15px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 8px;
    font-size: 0.9rem;
    border-left: 4px solid #2e7d32;
}

.btn-block {
    width: 100%;
}

/* Responsive Auth Styles */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .header-left {
        text-align: center;
    }

    .header-right {
        justify-content: center;
    }

    .modal-auth {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .auth-status {
        width: 100%;
        justify-content: center;
    }

    .user-email {
        font-size: 0.8rem;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .btn-login,
    .btn-logout {
        padding: 6px 15px;
        font-size: 0.85rem;
    }
}

/* Auth Prompt Banner */
.auth-prompt {
    background: linear-gradient(135deg, #43a047 0%, #1b5e20 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.auth-prompt h3 {
    color: white;
    font-family: var(--font-heading);
    font-weight: 900;
    font-style: italic;
}

.auth-prompt .btn-primary {
    background: white;
    color: var(--primary-color);
    border: 2px solid white;
}

/* Settings Modal */
.settings-modal {
    max-width: 700px;
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 900;
    font-style: italic;
}

.settings-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Font Size Selector */
.font-size-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: #f0f0f0;
    padding: 5px;
    border-radius: 10px;
}

.font-option {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.font-option span.preview {
    font-weight: bold;
    line-height: 1;
}

.font-option.selected {
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.font-option:hover:not(.selected) {
    background: rgba(255,255,255,0.5);
}

.background-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.background-option {
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s ease;
}

.background-option:hover {
    transform: translateY(-4px);
}

.background-option.selected .background-preview {
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.background-preview {
    width: 100%;
    height: 120px;
    border-radius: 0.75rem;
    border: 2px solid var(--border);
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-secondary);
}

.background-option p {
    font-size: 0.85rem;
    color: var(--text);
    margin: 0;
}

/* Background Styles */
.bg-none {
    background: var(--bg-secondary);
}

/* Plain color backgrounds with 50% transparency */
.bg-peach {
    background: rgba(255, 218, 185, 0.5);
}

.bg-mint {
    background: rgba(152, 251, 152, 0.5);
}

.bg-lavender {
    background: rgba(230, 230, 250, 0.5);
}

.bg-sky {
    background: rgba(135, 206, 235, 0.5);
}

.bg-rose {
    background: rgba(255, 182, 193, 0.5);
}

.bg-lemon {
    background: rgba(255, 250, 205, 0.5);
}

.bg-coral {
    background: rgba(255, 127, 80, 0.5);
}

.bg-sage {
    background: rgba(188, 212, 182, 0.5);
}

.auth-prompt .btn-primary:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

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

button:disabled:hover {
    transform: none;
}

/* ============================================================================
   RESPONSIVE DESIGN (MOBILE OPTIMIZATION)
   ============================================================================ */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        width: 100%;
        padding: 0;
    }

    /* Header Adjustments */
    .top-bar {
        flex-direction: column;
        gap: 12px;
        align-items: center;
        margin-bottom: 15px; /* Increase space between header and nav */
    }

    .logo-container {
        justify-content: center;
        width: 100%;
    }

    .app-logo {
        width: 100px; /* Smaller logo on mobile */
    }

    .user-controls {
        width: 100%;
        justify-content: center;
        margin-bottom: 5px;
    }

    .auth-user {
        align-items: center;
        width: 100%;
        gap: 5px;
    }

    .user-info-group {
        width: 100%;
        justify-content: center;
        margin-bottom: 5px;
        flex-wrap: wrap;
    }

    .credits-group {
        width: 100%;
        justify-content: center;
    }

    /* Navigation */
    .main-nav {
        gap: 8px;
        margin-top: 10px;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
        flex: 1;
        justify-content: center;
    }

    /* Cards */
    .card {
        padding: 20px;
        border-radius: 12px;
    }

    /* Recipe Content */
    .ingredients-two-column,
    .instructions-two-column {
        column-count: 1;
    }

    .recipe-meta {
        flex-direction: column;
        gap: 10px;
    }

    .meta-item {
        width: 100%;
        justify-content: space-between;
    }
    
    .recipe-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .recipe-actions button {
        width: 100%;
        justify-content: center;
    }

    /* Modals - Mobile styles moved to end of file for better specificity */
    .modal-content {
        /* See overrides at bottom of file */
    }

    .modal-header {
        /* See overrides at bottom of file */
    }

    .modal-actions {
        /* See overrides at bottom of file */
    }
    
    .modal-actions button {
        /* See overrides at bottom of file */
    }
    
    .modal-footer {
        /* See overrides at bottom of file */
    }
    
    .modal-footer button {
        /* See overrides at bottom of file */
    }

    /* Settings */
    .background-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    /* Pricing */
    .pricing-grid {
        grid-template-columns: 1fr;
    }
    
    /* Language Grid */
    .language-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   NEW INPUT METHODS LAYOUT
   ============================================================================ */

.input-methods-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    margin-top: 40px;
    min-height: 300px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
}

.input-method-section {
    flex: 1;
    background: var(--md-sys-color-surface);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.input-method-section:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.input-method-section.active {
    flex: 2.5;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    cursor: default;
}

.input-method-section:not(.active) {
    opacity: 0.9;
    background: var(--md-sys-color-surface-variant);
}

.input-method-section:not(.active):hover {
    opacity: 0.9;
    background: var(--md-sys-color-surface);
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem; /* Title Large */
    margin-bottom: 15px;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    font-weight: 600;
    font-style: normal;
}

.section-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.input-method-section.active .section-content {
    opacity: 1;
    pointer-events: all;
}

/* Compact Language Selector */
.language-selector-compact {
    margin-bottom: 20px;
}

.language-selector-compact label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 600;
}

.language-selector-compact select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
}

/* Modern Recording Controls - M3 FAB Style */
.recording-controls-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 20px;
}

.timer-display {
    font-size: 2.5rem;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.status-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.main-controls {
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-record-modern {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #FFEBEE; /* Red Container */
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.2, 0.0, 0, 1.0);
    box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); /* Elevation 3 */
}

.btn-record-modern:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); /* Elevation 4 */
    background: #FFCDD2;
}

.btn-record-modern.recording {
    background: #FFEBEE;
    animation: pulse-red-m3 2s infinite;
}

.record-dot {
    width: 32px;
    height: 32px;
    background: #D32F2F; /* Red 700 */
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-record-modern.recording .record-dot {
    background: #D32F2F;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    opacity: 1;
}

/* Secondary Controls - M3 Small FAB / Icon Button */
.secondary-controls {
    display: flex;
    gap: 16px; /* M3 Standard Gap */
    margin-top: 16px;
    animation: slideUpFade 0.3s ease;
}

.btn-control-modern {
    width: 56px; /* M3 FAB Size */
    height: 56px;
    border-radius: 16px; /* M3 Container Shape */
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--md-sys-elevation-1);
}

.btn-control-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--md-sys-elevation-2);
}

/* Stop Button - Error Tonal */
#stopBtn {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

#stopBtn:hover {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

/* Pause/Resume - Primary Tonal */
#pauseBtn, #resumeBtn {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

#pauseBtn:hover, #resumeBtn:hover {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

/* Reset - Secondary Tonal */
#resetBtn {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

#resetBtn:hover {
    background: var(--md-sys-color-secondary);
    color: var(--md-sys-color-on-secondary);
}

/* Progress Bar Modern */
.progress-bar-modern {
    width: 100%;
    height: 4px; /* Thinner for M3 */
    background: #E0E0E0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 20px;
}

/* Upload Area Modern */
.upload-area-modern {
    flex: 1;
    border: 1px dashed var(--md-sys-color-outline); /* Thinner border */
    border-radius: 16px; /* M3 Medium shape */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: var(--md-sys-color-surface-variant);
}

.upload-area-modern:hover {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-secondary-container);
}

.upload-label-modern {
    text-align: center;
    cursor: pointer;
    padding: 20px;
}

.upload-label-modern .icon {
    font-size: 3rem;
    margin-bottom: 10px;
    display: block;
    color: var(--md-sys-color-on-surface-variant);
}

.upload-label-modern p {
    color: var(--md-sys-color-on-surface-variant);
    margin: 5px 0;
}

.upload-label-modern .file-info {
    font-size: 0.8rem;
    opacity: 0.7;
}

@keyframes pulse-red-m3 {
    0% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(211, 47, 47, 0); }
    100% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0); }
}

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

/* Responsive for Input Methods */
@media (max-width: 768px) {
    .input-methods-container {
        flex-direction: column;
        min-height: auto;
    }

    .input-method-section {
        flex: none;
        width: 100%;
        min-height: 80px; /* Collapsed height */
    }

    .input-method-section.active {
        flex: none;
        min-height: 400px;
    }
    
    .input-method-section:not(.active) .section-content {
        display: none;
    }
}

/* Mobile Responsiveness for Modal Buttons */
@media (max-width: 600px) {
    .modal-footer {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding-top: 15px;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-left: 0 !important; /* Override inline style on Share button */
        padding: 10px;
        font-size: 0.9rem;
        justify-content: center;
    }

    /* Also adjust modal actions (Edit/Delete) */
    .modal-actions {
        display: flex;
        gap: 5px;
    }
    
    .modal-actions .btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}


/* Animated Outline Logo */
.animated-logo-outline {
    position: relative;
    height: 120px;
    width: 140px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.pan-icon {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-top: 10px;
}

.pan-bowl {
    width: 60px;
    height: 30px;
    border: 4px solid #444;
    border-top: 4px solid#444;
    border-radius: 0 0 30px 30px;
    position: relative;
}

.pan-handle {
    width: 40px;
    height: 0;
    border-top: 4px solid #444;
    margin-top: 0; /* Align with top of bowl */
    margin-left: -2px; /* Connect */
    transform-origin: left;
    transform: rotate(-10deg); /* Slight angle up */
}

.steam-group {
    display: flex;
    gap: 10px;
    height: 10px;
    margin-bottom: 5px;
    justify-content: center;
    width: 60px; /* Match bowl width */
    transform: translateX(-20px); /* Center steam over the bowl (offset due to handle) */
}

.steam-wave {
    width: 6px;
    height: 20px;
    border-left: 3px solid #444;
    border-radius: 50%;
    opacity: 0;
}

.steam-wave.s1 { animation: steam-rise-wave 2s infinite 0s; }
.steam-wave.s2 { animation: steam-rise-wave 2s infinite 0.6s; height: 25px; }
.steam-wave.s3 { animation: steam-rise-wave 2s infinite 1.2s; }

@keyframes steam-rise-wave {
    0% { transform: translateY(0) scaleY(1); opacity: 0; }
    20% { opacity: 0.8; }
    100% { transform: translateY(-20px) scaleY(1.5) translateX(5px); opacity: 0; }
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 0;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    background: var(--md-sys-color-background);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    z-index: 10;
}

.app-footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.footer-link:hover {
    opacity: 1;
}

.footer-logo {
    height: 20px;
    vertical-align: middle;
    /* Optional: Add filter if logo needs to be inverted in dark mode */
    /* filter: grayscale(100%); */
}

/* Mobile Optimization for Recipe Card Buttons */
@media (max-width: 768px) {
    .recipe-actions {
        gap: 8px;
        margin-top: 15px;
        /* Ensure buttons can sit side-by-side if they fit */
        flex-direction: row; 
        flex-wrap: wrap;
    }

    .recipe-actions .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-width: auto; /* Override the 200px min-width */
        flex: 1 1 45%; /* Allow buttons to take up about half width, minus gap */
        white-space: nowrap; /* Prevent text wrapping inside button if possible */
    }

    /* Adjust recipe card padding to give more space */
    .recipe-card {
        padding: 15px;
        margin-left: 10px;
        margin-right: 10px;
    }
    
    #recipeContent {
        padding: 12px;
    }

    /* ============================================================================
       MOBILE MODAL OVERRIDES (High Specificity)
       ============================================================================ */
    
    /* 1. Full Screen Modal for better reading experience */
    .modal-content {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100% !important;
        max-height: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 15px !important;
    }

    /* Ensure images in modal content have rounded corners on mobile */
    .modal-body img,
    #modalRecipeContent img {
        border-radius: 12px !important;
        max-width: 100%;
        height: auto;
    }

    /* 2. Compact Header */
    .modal-header {
        flex-direction: row !important; /* Force row */
        align-items: center !important;
        justify-content: space-between !important;
        padding: 10px 15px !important;
        padding-right: 45px !important; /* Space for Close button */
        gap: 10px !important;
        flex-shrink: 0; /* Don't shrink header */
    }

    .modal-header h2 {
        font-size: 1.1rem !important;
        margin: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
    }

    .modal-actions {
        width: auto !important; /* Don't take full width */
        display: flex !important;
        flex-direction: row !important; /* Explicitly row */
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }

    .modal-actions .btn {
        flex: 0 0 auto !important; /* Don't grow */
        min-width: auto !important;
        padding: 6px 12px !important; /* Slightly larger touch target */
        font-size: 0.8rem !important;
        width: auto !important;
    }

    /* 3. Compact Footer (Toolbar Style) */
    .modal-footer {
        flex-direction: row !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr; /* 3 Equal columns */
        gap: 8px !important;
        padding: 8px !important;
        background: var(--md-sys-color-surface);
        border-top: 1px solid var(--md-sys-color-outline-variant);
        flex-shrink: 0; /* Don't shrink footer */
    }

    .modal-footer .btn {
        width: 100% !important;
        margin: 0 !important;
        padding: 6px 2px !important;
        font-size: 0.7rem !important;
        display: flex !important;
        flex-direction: column !important; /* Stack Icon and Text */
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        height: auto !important;
        border-radius: 8px !important;
    }

    .modal-footer .btn .icon {
        font-size: 1.2rem !important;
        margin: 0 !important;
    }
    
    /* Ensure Close button is visible and positioned correctly */
    .modal-close {
        top: 10px !important;
        right: 10px !important;
        z-index: 20;
        background: var(--md-sys-color-surface-variant);
        color: var(--md-sys-color-on-surface-variant);
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: var(--md-sys-elevation-1);
    }
}


/* Visibility Toggle Switch */
.visibility-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: '';
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--md-sys-color-primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--md-sys-color-primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.visibility-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

/* ============================================================================
   DARK MODE TEXT READABILITY ENHANCEMENTS
   ============================================================================ */

[data-theme="dark"] .recipe-title {
    color: #e8e8e8;
}

[data-theme="dark"] .recipe-author {
    color: #c0c0c0;
    font-weight: 600;
}

[data-theme="dark"] .recipe-description {
    color: #e0e0e0;
    font-weight: 500;
}

[data-theme="dark"] .meta-label {
    color: #e8e8e8;
    font-weight: 700;
}

[data-theme="dark"] .meta-value {
    color: #e8e8e8;
    font-weight: 700;
}

[data-theme="dark"] .recipe-section-title {
    color: #7dd77d;
    border-bottom-color: #7dd77d;
    font-weight: 700;
}

[data-theme="dark"] .ingredients-list li {
    color: #d8d8d8;
    font-weight: 500;
}

[data-theme="dark"] .instructions-list li {
    color: #d8d8d8;
    font-weight: 500;
}

[data-theme="dark"] .tips-list li,
[data-theme="dark"] .recipe-section p {
    color: #d8d8d8;
    font-weight: 500;
}
