/* 
  Meating Steakhouse Order App - Vanilla CSS
  Apple HIG Vibe, Glassmorphism, Dark Mode Support
*/

:root {
    /* Brand Tokens */
    --color-brand-red: #AD0E11;
    --color-brand-red-hover: #8C0A0D;

    /* Defaults (Light Mode) */
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.85);
    /* Slightly less opaque for better contrast */
    --glass-border: rgba(0, 0, 0, 0.10);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Dynamic element variables */
    --input-bg: rgba(0, 0, 0, 0.05);
    --hover-bg: rgba(0, 0, 0, 0.08);
    --search-bg: rgba(0, 0, 0, 0.05);
    /* Grey indent for light mode */

    /* Status Colors */
    --status-grey: #e5e5ea;
    --status-pink: #ff2d55;
    --status-red: #AD0E11;
    --status-blue: #007aff;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-header: 'Bebas Neue', sans-serif;
}

[data-theme='dark'] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #121212;
    --text-primary: #f5f5f7;
    --text-secondary: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(10, 10, 10, 0.85);
    /* Deepen black for Chrome */
    --glass-border: rgba(255, 255, 255, 0.08);
    --status-grey: #3a3a3c;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
    --input-bg: rgba(255, 255, 255, 0.15);
    /* White indent for dark mode */
    --hover-bg: rgba(255, 255, 255, 0.2);
    --search-bg: rgba(255, 255, 255, 0.15);
    /* White indent for dark mode search */
}

[data-theme='light'] {
    --bg-primary: #f5f5f5;
    /* Fully opaque to prevent system background from bleeding through in Safari */
    --bg-secondary: #ffffff;
    --text-primary: #121212;
    --text-secondary: #555555;
    --border-color: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.85);
    /* Fix contrast */
    --glass-border: rgba(0, 0, 0, 0.10);
    --status-grey: #e5e5ea;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --input-bg: rgba(0, 0, 0, 0.05);
    /* Grey indent for light mode */
    --hover-bg: rgba(0, 0, 0, 0.08);
    --search-bg: rgba(0, 0, 0, 0.05);
    /* Grey indent for light mode search */
}

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

html {
    background-color: var(--bg-primary);
    /* Solid fallback base to prevent Safari backdrop-filter black box rendering bug */
    min-height: 100vh;
}

body {
    font-family: var(--font-family);
    background-color: transparent;
    /* Must be strictly transparent or gradients will blend and wash out the image */
    background-image: url('./Marbled%20Background%20Light.png');
    /* Light Mode fallback */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 
 * Apply background directly per theme.
 */
[data-theme='dark'] body {
    background-image: url('./Marbled%20Background.jpg');
}

[data-theme='light'] body {
    background-image: url('./Marbled%20Background%20Light.png');
}


h1,
h2,
h3,
.greeting,
.login-title {
    font-family: var(--font-header);
    letter-spacing: 1px;
}

/* Utilities */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    border-radius: 16px;
    -webkit-transform: translate3d(0, 0, 0);
    /* Safari Backdrop Filter Bug Fix */
    transform: translate3d(0, 0, 0);
    /* Force GPU compositing */
}

.hidden {
    display: none !important;
}

/* Login Screen */
#login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.login-card {
    width: 90%;
    max-width: 400px;
    padding: 40px 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.login-logo {
    width: 250px;
    height: auto;
    background: transparent !important;
    box-shadow: none !important;
    margin: 0 auto 10px;
    object-fit: contain;
}

.login-title {
    font-size: 32px;
    font-weight: 400;
}

.btn-primary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 16px 24px;
    border-radius: 16px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: normal;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.btn-primary:hover {
    transform: translateY(-2px);
    border-color: #cc1a1a;
    box-shadow: 0 4px 16px rgba(204, 26, 26, 0.2);
}

.btn-primary:active {
    transform: scale(0.97) translateY(0);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 16px 24px;
    border-radius: 16px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: normal;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    border-color: #cc1a1a;
    box-shadow: 0 4px 16px rgba(204, 26, 26, 0.2);
}

.btn-secondary:active {
    transform: scale(0.97) translateY(0);
}

.btn-mark-ordered:hover {
    border-color: var(--status-blue) !important;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3) !important;
    color: var(--status-blue) !important;
}

/* Light Mode Overrides for Visibility */
[data-theme='light'] .btn-primary,
[data-theme='light'] .btn-secondary,
[data-theme='light'] input,
[data-theme='light'] textarea,
[data-theme='light'] .logout-link {
    color: #1a1a1a !important;
}

[data-theme='light'] #login-screen button {
    background: rgba(0, 0, 0, 0.08) !important;
    color: #1a1a1a !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Dashboard App Container */
#dashboard {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header & Navigation redesign - Using Grid for bulletproof true centering */
.app-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 20px;
    height: 120px;
    /* Taller header to comfortably fit the agreed-upon larger logo */
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.header-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

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

.header-logo {
    object-fit: contain;
    background: transparent !important;
    box-shadow: none !important;
}

.app-header img.meating-logo {
    height: 90px !important;
    /* Explicit height prevents SVG collapse, using agreed upon larger size */
    min-width: 200px;
    /* Fallback to prevent invisible SVG */
    object-fit: contain;
}

.greeting {
    font-size: 22px;
    /* Slightly smaller for a sleeker header */
    font-weight: 400;
    text-align: center;
}

/* --- Settings Dropdown --- */
.settings-dropdown {
    position: absolute;
    top: 95px;
    /* Right below the 120px header */
    right: 20px;
    width: 200px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 8px 0;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-dropdown.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    letter-spacing: 1px;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    box-sizing: border-box;
}

.dropdown-item:hover {
    background: var(--hover-bg);
}

/* Subtle icon for dropdown actions */
.dropdown-item i {
    font-size: 14px;
    opacity: 0.7;
}

.dropdown-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 8px 0;
}

/* Simple inline theme toggle pill inside dropdown */
.dropdown-theme-toggle {
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    position: relative;
    transition: all 0.3s;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.dropdown-theme-knob {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transform: translateX(16px);
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme='light'] .dropdown-theme-toggle {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme='light'] .dropdown-theme-knob {
    transform: translateX(0);
}

/* Main Content Area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
}

/* Dashboard Grid */
.supplier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.supplier-card {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.supplier-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: #cc1a1a;
}

.supplier-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
}

.supplier-name {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

/* Add Item Button */
.add-item-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.add-item-btn:hover {
    transform: translateY(-2px);
    border-color: var(--color-brand-red);
    box-shadow: 0 4px 12px rgba(173, 14, 17, 0.15);
    color: var(--color-brand-red);
}

.add-item-btn:active {
    transform: translateY(0) scale(0.96);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    position: absolute;
    right: 16px;
    /* Inset from the full width edge to prevent clipping */
}

.status-dot.grey {
    background-color: var(--status-grey);
}

.status-dot.pink {
    background-color: var(--status-pink);
}

.status-dot.red {
    background-color: var(--status-red);
}

.status-dot.blue {
    background-color: var(--status-blue);
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .main-content {
        padding: 16px 12px 100px 12px;
    }

    .app-header {
        padding: 15px;
        height: 100px;
        /* Taller on mobile to fit the scaled logo */
    }

    .app-header img.meating-logo {
        height: 70px !important;
        /* Larger logo size agreed upon previously */
        min-width: 160px;
    }

    .supplier-card {
        padding: 20px;
    }

    .theme-toggle-wrapper {
        bottom: 15px;
        right: 15px;
        background: rgba(0, 0, 0, 0.4);
        padding: 5px 8px;
        border-radius: 30px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

.supplier-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Item Modal Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Daily Log Styles (v33 Consistency Polish) --- */
.daily-log-container {
    animation: fadeIn 0.3s ease;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

.daily-log-category-title {
    text-align: center;
    color: var(--text-primary);
    padding: 8px 0;
    font-family: var(--font-header);
    font-size: 26px;
    letter-spacing: 2px;
    border-bottom: 2px solid var(--color-brand-red);
    margin: 32px auto 20px;
    max-width: 280px;
    text-transform: uppercase;
}

.daily-log-input-group {
    display: flex !important;
    gap: 12px;
}

.daily-log-input-wrapper {
    width: 65px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.daily-log-input-label {
    display: block;
    width: 100%;
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.daily-log-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
}

.daily-log-input:focus {
    border-color: var(--color-brand-red);
    background: var(--hover-bg);
    box-shadow: 0 0 0 2px rgba(173, 14, 17, 0.1);
}

/* History Styles (v34) */
.history-entry-card {
    margin-bottom: 16px;
    padding: 24px;
}

.history-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.history-entry-date {
    font-family: var(--font-header);
    font-size: 20px;
    color: var(--text-primary);
}

.history-entry-details {
    margin-top: 20px;
    display: none;
}

.history-entry-details.active {
    display: block;
}

.history-section-group {
    margin-top: 24px;
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
}

.history-section-title {
    font-family: var(--font-header);
    font-size: 18px;
    color: var(--color-brand-red);
    letter-spacing: 1px;
    margin-bottom: 12px;
    text-align: center;
}

.history-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.history-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-item-counts {
    display: flex;
    gap: 12px;
}

.count-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
}

.count-label {
    font-size: 8px;
    color: var(--text-secondary);
    margin-bottom: 2px;
    font-weight: 700;
}

.count-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary) !important;
}

/* Mobile Overrides (v33) */
@media (max-width: 600px) {
    .daily-log-container {
        padding: 0 12px;
    }

    .daily-log-category-title {
        font-size: 22px;
        margin: 24px auto 16px;
    }
}