/* Header Component Styles - DECZON */

/* Root Variables - Vela Inspired Color Scheme */
:root {
    --primary-color: #2c2c2c;
    --primary-dark: #1a1a1a;
    --primary-light: #404040;
    --secondary-color: #f8f8f8;
    --secondary-dark: #e8e8e8;
    --accent-color: #ffc000;
    --accent-dark: #ffc800;

    --text-primary: #2c2c2c;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-light: #ffffff;

    --bg-primary: #ffffff;
    --bg-secondary: #f8f8f8;
    --bg-tertiary: #f0f0f0;
    --bg-dark: #2c2c2c;

    --border-color: #e0e0e0;
    --border-light: #f0f0f0;

    --success-color: #28A745;
    --warning-color: #FFC107;
    --error-color: #DC3545;

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;

    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-base: 15px;
    --font-size-lg: 17px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    --font-size-4xl: 48px;

    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);

    --container-max-width: 1200px;
    --header-height: 80px;
    --category-nav-height: 56px;
}

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

body {
    font-family: 'Nunito', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    font-size: var(--font-size-base);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-xs);
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    opacity: 0.3;
}

.header-content {
    display: flex;
    flex-direction: column;
    position: relative;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: var(--spacing-md);
    position: relative;
    padding: 0 8px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-2xl);
    flex: 1 1 0;
    min-width: 0;
    z-index: 20;
    position: relative;
    margin-left: -100px;
}

.logo {
    flex-shrink: 0;
    z-index: 25;
    position: relative;
}

.location-selector {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    white-space: nowrap;
    font-weight: 500;
    min-width: fit-content;
    z-index: 15;
    position: static;
    user-select: none;
    margin-left: -14px;
}

.header-search {
    flex: 0 1 800px;
    max-width: 800px;
    margin: 0 auto;
    z-index: 10;
    position: relative;
    display: flex;
    justify-content: center;
}

.logo-img {
    height: 114px;
    width: auto;
}

.logo { 
    display: flex; 
    align-items: center; 
    margin-left: -12px; 
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    flex: 1 1 0;
    min-width: 0;
    justify-content: flex-end;
    margin-right: -100px;
}

.location-text {
    font-weight: 600;
    color: var(--text-primary);
}

.location-selector:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.location-selector:active {
    transform: translateY(0);
}

.location-icon, .dropdown-icon {
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.location-selector:hover .location-icon,
.location-selector:hover .dropdown-icon {
    color: var(--accent-color);
}

.dropdown-icon {
    transition: transform 0.2s ease;
}

.location-selector:hover .dropdown-icon {
    transform: rotate(180deg);
}

.location-selector.loading {
    opacity: 0.7;
    pointer-events: none;
}

.location-selector.loading .location-text {
    color: var(--text-muted);
}

.location-selector.loading .location-icon {
    animation: pulse 1.5s infinite;
}

.location-selector:active {
    transform: scale(0.98);
}

.location-selector .location-text {
    transition: color 0.2s ease;
}

.location-selector:hover .location-text {
    color: var(--accent-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    z-index: 20;
    position: relative;
    flex-shrink: 0;
}

.user-section, .cart-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.user-section:hover, .cart-section:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.cart-section {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--accent-color);
    color: var(--text-light);
    font-size: var(--font-size-xs);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.three-dot-menu {
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
    color: var(--text-secondary);
}

.three-dot-menu:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Position dropdown relative to three-dot menu */
.three-dot-menu {
    position: relative;
}

/* Ensure dropdown appears below the three-dot menu */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1001;
    display: none;
    overflow: hidden;
}

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

.dropdown-menu a {
    display: block;
    padding: var(--spacing-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-light);
}

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

.dropdown-menu a:hover {
    background-color: var(--bg-secondary);
}

/* Header Search Styles */
.header-search {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin: 0 1px;
}

.search-input-group {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    height: 38px;
    backdrop-filter: blur(10px);
    width: 125%;
}

.search-icon-left {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-icon-left:hover {
    color: var(--accent-color);
}

.search-input-group:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-md);
}

.search-input-group:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 192, 0, 0.1);
    transform: translateY(-1px);
}

.search-input {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    outline: none;
    font-size: var(--font-size-xs);
    background: transparent;
    color: var(--text-primary);
    height: 100%;
    font-family: inherit;
    padding-left: var(--spacing-sm);
}

.search-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.search-input:focus::placeholder {
    opacity: 0.7;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding-right: var(--spacing-sm);
}

.camera-btn, .search-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.camera-btn:hover {
    background: var(--bg-secondary);
    color: var(--accent-color);
    transform: scale(1.05);
}

.search-btn:hover {
    background: var(--accent-color);
    color: var(--text-light);
    transform: scale(1.05);
}

/* Search Results Styles */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-top: var(--spacing-xs);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.search-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.results-count {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.clear-search {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.clear-search:hover {
    text-decoration: underline;
}

.search-results-list {
    padding: var(--spacing-sm);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-image {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.search-result-category {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Camera Modal Styles */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.camera-modal.show {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.camera-modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.camera-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.camera-modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--font-size-lg);
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.camera-modal-body {
    padding: var(--spacing-lg);
}

.camera-tabs {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.camera-tab {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all 0.2s ease;
    font-size: var(--font-size-sm);
}

.camera-tab.active {
    background: var(--accent-color);
    color: var(--text-light);
}

.camera-tab:hover:not(.active) {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.camera-tab-content {
    display: none;
}

.camera-tab-content.active {
    display: block;
}

.camera-preview {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
    aspect-ratio: 4/3;
}

#cameraVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    text-align: center;
}

.camera-frame {
    width: 200px;
    height: 200px;
    border: 2px dashed var(--accent-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
}

.camera-controls {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
}

.capture-btn, .switch-camera-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all 0.2s ease;
}

.capture-btn {
    background: var(--accent-color);
    color: var(--text-light);
}

.capture-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
}

.switch-camera-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.switch-camera-btn:hover {
    background: var(--bg-tertiary);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-2xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-area:hover {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
}

.upload-placeholder {
    color: var(--text-secondary);
}

.upload-placeholder svg {
    margin-bottom: var(--spacing-sm);
    color: var(--text-muted);
}

.captured-image {
    text-align: center;
    margin-top: var(--spacing-lg);
}

#previewImage {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    border: 2px solid var(--border-color);
}

.image-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
}

.retake-btn, .search-image-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all 0.2s ease;
}

.retake-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.retake-btn:hover {
    background: var(--bg-tertiary);
}

.search-image-btn {
    background: var(--accent-color);
    color: var(--text-light);
}

.search-image-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Focus States for Accessibility */
button:focus,
input:focus,
a:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Mobile Responsive Styles */
@media (max-width: 1024px) {
    .header-left {
        margin-left: 0;
    }
    
    .header-right {
        margin-right: 0;
    }
    
    .header-search {
        flex: 0 1 600px;
    }
}

@media (max-width: 768px) {
    .header-top {
        height: 60px;
        padding: 0 var(--spacing-sm);
    }
    
    .logo-img {
        height: 90px;
    }
    
    .location-selector {
        display: none;
    }

    .header-search {
        flex: 1;
        max-width: none;
        margin: 0 var(--spacing-sm);
    }

    .search-input-group {
        width: 100%;
    }

    .header-right {
        gap: var(--spacing-sm);
    }
    
    .user-section span, .cart-section span {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-top {
        gap: var(--spacing-sm);
    }

    .logo-img {
        height: 70px;
    }

    .search-actions {
        display: none;
    }

    .header-right {
        gap: var(--spacing-xs);
    }
}
