/* base.css - NeatSpecs Theme System Implementation */

/* ===== THEME SYSTEM: THREE-LAYER CSS VARIABLE ARCHITECTURE ===== */

:root {
    /* ===== LAYER 1: BASE COLOR DEFINITIONS ===== */
    /* These are now set by establishment-theme.js - defining fallbacks only */
    
    /* Brand Colors - These are the defaults that can be customized by the user */
    --primary-brand: #cc0000;   /* Default red for primary brand color */
    --secondary-brand: #ff9900; /* Default orange for secondary brand color */
    --third-brand: #274e13;     /* Default dark green for third brand color */
    --fourth-brand: #ffffff;    /* Default white for fourth brand color */
    --fifth-brand: #ffffff;     /* Default white for fifth brand color */
    
    /* Base Colors - All possible colors defined at root level */
    --pure-white: #ffffff;      /* Pure white (#ffffff) */
    --near-white: #f5f5f5;      /* Near white/very light gray */
    --light-gray: #dddddd;      /* Light gray for subtle elements */
    --medium-gray: #999999;     /* Medium gray for secondary text/icons */
    --dark-gray: #333333;       /* Dark gray (near-black) for primary text */
    --near-black: #121212;      /* Near black - softer than pure black */
    --dark-charcoal: #1e1e1e;   /* Dark charcoal - slightly lighter than near-black */
    --pure-black: #000000;      /* Pure black */
    
    /* Functional Colors - Colors with specific meanings/purposes (customizable per brand) */
    --warning-red-brand: #e25a4a;     /* Default red for warnings/alerts/destructive actions */
    --add-green-brand: #4CAF50;       /* Default green for success/add actions */
    --caution-yellow-brand: #FFC107;  /* Default yellow for caution/attention */
    --info-blue-brand: #2196F3;       /* Default blue for information/help */
    
    /* ===== LAYER 2: SEMANTIC MAPPINGS ===== */
    /* These are set by establishment-theme.js based on light/dark theme */
    /* Providing fallback values only */
    --page-color: var(--pure-white);
    --text-color: var(--dark-gray);
    --titleColor: var(--primary-brand);
    --banner-color: var(--pure-white);
    --borderColor: var(--third-brand);
    --banner-title-color: var(--pure-black);
    
    /* ===== BACKWARDS COMPATIBILITY MAPPINGS ===== */
    /* Map old naming convention to new naming convention */
    /* These will be removed in future versions */
    --primary-color: var(--primary-brand);
    --secondary-color: var(--secondary-brand);
    --tertiary-color: var(--third-brand);
    --text-color: var(--textColor);
    --card-background: var(--cardBackground);
    --border-color: var(--borderColor);
    --text-primary: var(--textColor);
    --text-secondary: var(--textColor);
    
    /* Theme backgrounds - for backwards compatibility */
    --light-background: var(--pure-white);
    --dark-background: var(--near-black);
    
    /* Page background mapping */
    --page-background: var(--background);
    --white: var(--pure-white);
    --text-dark: var(--textColor);
    --text-light: var(--background);
    
    /* State Colors and System Colors */
    --state-hover: rgba(0, 0, 0, 0.1);
    --state-active: var(--primary-brand);
    --state-disabled: var(--textColor);
    
    /* ===== TYPOGRAPHY, SPACING, LAYOUT VARIABLES ===== */
    /* These remain unchanged from the original base.css */
    
    --font-family-base: Arial, system-ui, sans-serif;
    --font-size-base: 1rem;
    --font-size-lg: 1.5rem;
    --font-size-xl: 2rem;
    --font-size-menu: clamp(16px, 3.5vw, 40px);
    
    --spacing-base: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.25rem;
    --section-gap: 1.25rem;
    --img-height: 45px;
    
    --container-max-width: 800px;
    --border-radius-sm: 0.25rem;
    --border-radius: 0.5rem;
    
    --z-index-base: 1;
    --z-index-overlay: 10;
    --z-index-modal: 100;
    --z-index-sticky: 100;
    
    /* Theme transition for smooth switching */
    --transition-speed: 300ms;
    --transition-base: var(--transition-speed) ease-in-out;

    /* Dynamic SVG color variables */
    --logo-color: var(--text-color);  /* This maps logo color to text color */
    --icon-color: var(--text-color);  /* For other icons if needed */
    --nav-color: var(--text-color);   /* For navigation icons */
}

/* Dark theme should inherit the mapping automatically since --text-color changes with theme */
[data-theme="dark"] {
    /* The --logo-color will automatically update when --text-color changes */
    /* No need to redefine unless you want different behavior */
}

/* Dark theme adjustments for state colors */
[data-theme="dark"] {
    /* State colors in dark mode */
    --state-hover: rgba(255, 255, 255, 0.1);
}

/* ===== LAYER 3: COMPONENT APPLICATION ===== */
/* Base element styling with theme variables */

/* Apply smooth transitions for theme switching */
body, 
button,
a,
input,
.content-section,
.dropdown-menu,
.header-row svg,
.menu-icon svg,
.bar-menu-section,
.cocktail-border,
header,
.logo-container img,
.footer,
.icon-btn,
.dropdown-item {
    transition: color var(--transition-base), 
                background-color var(--transition-base), 
                border-color var(--transition-base),
                fill var(--transition-base),
                box-shadow var(--transition-base);
}

html, body {
    height: 100%;
    margin: 0;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--page-color);  /* Use page-color instead */
    color: var(--text-color);  /* Also update this for consistency */
}

/* ===== HEADER COLOR STYLING (All header colors managed here) ===== */

/* Hamburger menu - target the line elements specifically */
.neatspecs-header .menu-button svg line,
.establishment-header .menu-button svg line {
    stroke: var(--text-color);
}

/* Auth button icons - apply filter to match text color 
.neatspecs-header .auth-btn object,
.establishment-header .auth-btn object {
    filter: brightness(0) saturate(100%) opacity(0.8);
    transition: filter var(--transition-base);
}

/* Make auth button icons match text color in dark themes 
[data-theme="dark"] .neatspecs-header .auth-btn object,
[data-theme="dark"] .establishment-header .auth-btn object {
    filter: brightness(0) saturate(100%) invert(1) opacity(0.8);
}*/

/* Auth button styling - use text-color for consistency with hamburger menu */
.auth-btn,
.neatspecs-header .auth-btn,
.establishment-header .auth-btn {
    background: none;
    border: none;
    padding-top: 0rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
}

/* Hover effects for auth button */
.auth-btn:hover,
.neatspecs-header .auth-btn:hover,
.establishment-header .auth-btn:hover {
    opacity: 0.7;
}

.auth-btn img.active {
    display: block;
}

.auth-btn img {
    display: none;
}

.auth-btn img.sign-in-icon {
    width: 100%;
    height: 100%;
    max-height: 40px;
    object-fit: contain;
}

.auth-btn img.profile-icon {
    width: 100%;
    height: 100%;
    max-height: 40px;
    object-fit: contain;
}

/* Theme Toggle Styles */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    /*background-color: var(--medium-gray);*/
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--medium-gray);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: var(--near-white);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--medium-gray);
}

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

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

/* Theme options in settings page */
.theme-options {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.theme-preview {
    width: 120px;
    height: 200px;
    border-radius: 12px;
    border: 2px solid var(--borderColor);
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition-base);
}

.theme-preview.light {
    background-color: var(--pure-white);
}

.theme-preview.dark {
    background-color: var(--near-black);
}

.theme-preview .header {
    height: 20px;
    background-color: var(--banner-title-color);
    margin-bottom: 10px;
}

.theme-preview .content-line {
    height: 10px;
    margin: 8px;
    border-radius: 5px;
    background-color: var(--banner-color)
}

/*.theme-preview.light .content-line {
    background-color: var(--banner-color);
}

.theme-preview.dark .content-line {
    background-color: var(--banner-color);
}*/

.theme-selector {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--medium-gray);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: border-color var(--transition-base);
}

.theme-selector.selected {
    border-color: var(--medium-gray);
}

.theme-selector.selected::after {
    content: "";    
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--medium-gray);
}

/* From original base.css */
/* Content Layout */
.design-wrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 1rem;
    background-color: var(--page-color);
}

.design-wrapper > div {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    padding-top: 10vh;
    padding-bottom: 0vh;
}

.design-wrapper .row.spacing {
    width: 100%;
}

/* Active menu section */
.bar-menu-section.active {
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-brand);
}

/* Borders */
.cocktail-border {
    border: 1px solid var(--secondary-brand);
}

/* Used Heading Styles */
h1 {
    color: var(--textColor);
    padding-bottom: var(--spacing-base);
    font-size: var(--font-size-lg);
    font-weight: bold;
    text-transform: uppercase;
}

/* Header Styles */
header {
    flex-shrink: 0;
    background-color: var(--background);
}

.header-side-container {
    width: 120px;
    display: flex;
    align-items: flex-start;  
    justify-content: center;
}

.page-container {
    width: 70%;
    margin: 3rem auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Content Sections */
.content-section {
    color: var(--banner-title-color);
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid var(--border-color);
    background-color: var(--banner-color); /* CHANGE: was var(--cardBackground) */
}

.content-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.content-section h3 {
    color: var(--banner-title-color);
    margin: 0;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.section-link {
    text-decoration: none;
    display: block;
    width: 100%;
    height: 100%;
}

/* Button Styles */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 100px;
    height: auto;
    padding: 8px;
}

.icon-btn:hover {
    transform: scale(1.05);
}

/* Dropdown Styles */
.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--cardBackground);
    border: 1px solid var(--borderColor);
    border-radius: 4px;
    padding: 0.5rem 0;
    min-width: 200px;
    display: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 3000;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--textColor);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: var(--state-hover);
    color: var(--primary-brand);
}

/* Footer Styles */
.footer {
    flex-shrink: 0;
    background-color: var(--card-background);
    color: var(--text-color);
    padding: 1.5rem;
    width: 100%;
    
}

.footer .logo-container {
    max-width: 200px;
    margin: 0 auto;
    margin-bottom: 1rem;
}

.footer .logo-container img {
    max-width: 100%;
    height: auto;
}

/* Footer Styles 
.footer {
    flex-shrink: 0;
    background-color: var(--cardBackground);
    color: var(--textColor);
    padding: 1.5rem;
    width: 100%;
    
}

.footer .logo-container {
    max-width: 200px;
    margin: 0 auto;
    margin-bottom: 1rem;
}

.footer .logo-container img {
    max-width: 100%;
    height: auto;
}*/

/* Settings specific styles */
.settings-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.settings-title {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    text-align: center;
}

.footer-credit {
    text-align: center;
    margin-top: 0rem;
    padding-bottom: 2rem;
}

.footer-credit .logo {
    /*max-width: 120px;*/
}

/* Utility Classes */
.spacing {
    margin-bottom: 1rem;
}

.hidden {
    display: none;
}

html {
    scroll-behavior: smooth;
}

/* Responsive Design */
@media (max-width: 767.98px) {
    .page-container {
        width: 70%;
        padding: 0.5rem;
    }
    
    .header-side-container {
        width: 80px;
    }
    
    .icon-btn {
        max-width: 70px;
        max-height: 70px;
        padding: 12px;
    }

    .content-section {
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .content-section h3 {
        font-size: 1.25rem;
    }

    .dropdown-menu {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        margin: 0;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 1050;
    }

    .dropdown-item {
        padding: 1rem;
        text-align: center;
        border-bottom: 1px solid var(--borderColor);
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .dropdown-item:last-child {
        border-bottom: none;
    }

    .auth-btn {
        padding-top: 0.75rem;
    }
}

/* Apply the dropdown styles to the mobile-dropdown class */
.dropdown-menu.mobile-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--page-color);
    border: 1px solid var(--borderColor);
    border-radius: 4px;
    padding: 0.5rem 0;
    min-width: 200px;
    display: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 3000;
}

.dropdown-menu.mobile-dropdown.show {
    display: block;
}

/* Ensure the dropdown container has proper positioning */
.position-relative {
    position: relative;
}

/* Responsive styling to match your base.css for mobile devices */
@media (max-width: 767.98px) {
    .dropdown-menu.mobile-dropdown {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        margin: 0;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 3000;
    }
}

/* Logo Standardization Styles */

/* 
 * Header layout adjustments using percentage-based sizing
 * This ensures the header always fits within viewport width
 */
.header-container .d-flex {
    align-items: center; /* Ensure vertical alignment */
    position: relative; /* For proper positioning */
    width: 100%; /* Full width of parent */
    overflow: hidden; /* Prevent horizontal overflow */
    min-height: 150px;
}

/* Fixed-size logo container with consistent spacing */
.logo-container {
    flex: 0 1 60%; /* Allow shrinking, don't allow growing, take 60% of space */
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0; /* Vertical padding only */
    height: auto; /* Let content determine height */
    overflow: hidden; /* Prevent overflow */
}

/* Logo image styling */
.logo-container img {
    max-width: 100%; /* Never exceed container width */
    max-height: 100px; /* Cap the height */
    width: auto; /* Preserve aspect ratio */
    height: auto; /* Preserve aspect ratio */
    object-fit: contain; /* Ensures logo fits within boundaries */
}

/* Ensure side containers maintain consistent width */
.header-container .d-flex > div:first-child,
.header-container .d-flex > div:last-child {
    flex: 0 0 20%; /* Don't grow or shrink, take 20% of space */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Desktop enhancements */
@media (min-width: 1200px) {
    .logo-container {
        flex: 0 1 70%; /* Larger portion on desktop */
    }
    
    .logo-container img {
        max-height: 100px; /* Larger on desktop */
    }
    
    .header-container .d-flex > div:first-child,
    .header-container .d-flex > div:last-child {
        flex: 0 0 15%; /* Less space needed on desktop */
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1199px) {
    .logo-container img {
        max-height: 90px; /* Medium size for tablets */
    }
}

/* Minimal fix for dropdown visibility */
.position-relative {
    position: relative;
}

#authDropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--banner-color);
    border: 1px solid var(--border-color);
    z-index: 5000;
}

#authDropdown.show {
    display: block;
}

.firebase-emulator-warning {
    display: none !important;
}