/* ======================================== */
/* SHARED STYLES - ALL PAGES                */
/* ======================================== */

/* ======================================== */
/* 1. ROOT & THEME VARIABLES                */
/* ======================================== */
:root {
    /* Color Palette - HIGH CONTRAST LIGHT THEME */
    --primary: #0D47A1;
    --secondary: #1976D2;
    --accent: #64B5F6;
    --dark: #1A2A3A;
    --light: #F5F7FA;
    --gray: #DDE2E6;
    --steel: #495057;
    --metal: #8A9AAB;
    --bg-soft: #F8F9FA;
    --white-rgb: 255, 255, 255;

    /* Theming Variables (Light Mode) */
    --header-bg: rgba(var(--white-rgb), 0.85);
    --header-text: var(--dark);
    --body-bg: #E6EAED;
    --text-color: #212529;
    --card-bg: #FFFFFF;
    --section-bg-alt: #FFFFFF;
    --shadow-color: rgba(13, 71, 161, 0.1);
    --shadow-color-hover: rgba(13, 71, 161, 0.2);
    --input-bg: #FFFFFF;
    --input-border: #ced4da;
    --table-header-bg: var(--light);
    --table-stripe-bg: var(--bg-soft);

    /* Typography */
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Effects */
    --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* ======================================== */
/* INLINE SVG ICONS                         */
/* ======================================== */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
    flex-shrink: 0;
}

.icon-sm {
    width: 0.875em;
    height: 0.875em;
}

.icon-lg {
    width: 1.5em;
    height: 1.5em;
}

.icon-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Ensure SVG icons inherit color properly in all contexts */
.icon path {
    fill: currentColor;
}

body.dark-mode {
    /* Theming Variables (Dark Mode) */
    --header-bg: rgba(17, 24, 39, 0.85);
    --header-text: #FFFFFF;
    --text-color: #E6EDF5;
    --body-bg: #111827;
    --gray: #1f2937;
    --steel: #9ca3af;
    --metal: #6b7280;
    --card-bg: #1F2937;
    --section-bg-alt: #111827;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-color-hover: rgba(0, 0, 0, 0.5);
    --input-bg: #2b3548;
    --input-border: #4b5563;
    --primary: #42A5F5;
    --secondary: #64B5F6;
    --table-header-bg: #2b3548;
    --table-stripe-bg: #252e3d;
}

/* ======================================== */
/* 2. BASE & RESET STYLES                   */
/* ======================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--body-bg);
    overflow-x: hidden;
    min-height: 100vh;
    scroll-behavior: smooth;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 3px;
    border-radius: 2px;
}

input:focus-visible {
    outline-offset: 0;
}

/* ======================================== */
/* 3. UTILITY CLASSES                       */
/* ======================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.underline-title {
    position: relative;
    padding-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.underline-title::after {
    content: '';
    position: absolute;
    width: 50px;
    height: 3px;
    background: var(--secondary);
    bottom: 0;
    left: 0;
}

/* ======================================== */
/* 4. GLOBAL COMPONENTS                     */
/* ======================================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: var(--secondary);
    z-index: 900;
    width: 0%;
    transition: width 0.2s ease-out;
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--secondary);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top .icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary);
    transform: translateY(-5px);
}

.btn {
    padding: 1rem 2.2rem;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    font-size: 1.1rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px var(--shadow-color);
    gap: 0.75rem;
}

.btn .icon {
    width: 1.2em;
    height: 1.2em;
    flex-shrink: 0;
}

.btn:hover {
    box-shadow: 0 8px 20px var(--shadow-color-hover);
    transform: translateY(-5px);
}

.btn-primary {
    background: linear-gradient(45deg, var(--secondary), var(--primary));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(45deg, var(--primary), #002171);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    border: 1px solid transparent;
}

.btn-secondary:hover {
    background: var(--primary);
}

/* ======================================== */
/* 5. HEADER & NAVIGATION                   */
/* ======================================== */
header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.8rem 5%;
    padding-top: calc(0.8rem + env(safe-area-inset-top));
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 800;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--gray);
    transition: padding 0.3s ease, box-shadow 0.3s ease, background-color 0.4s ease;
}

header.scrolled {
    padding: 0.6rem 5%;
    padding-top: calc(0.6rem + env(safe-area-inset-top));
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 12px;
}

.logo img {
    height: 48px;
    width: auto;
    aspect-ratio: 1 / 1;
    transition: height 0.3s ease;
}

header.scrolled .logo img {
    height: 42px;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin: 0 0.8rem;
}

nav ul li a {
    color: var(--header-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    transition: var(--transition);
    position: relative;
    border-radius: 4px;
}

nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background: var(--secondary);
    transition: var(--transition);
}

nav ul li a:hover,
nav ul li a.active {
    color: var(--secondary);
}

nav ul li a:hover::after,
nav ul li a.active::after {
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-btn,
.menu-toggle,
.theme-toggle {
    background: none;
    border: none;
    color: var(--header-text);
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn .icon,
.menu-toggle .icon,
.theme-toggle .icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.search-btn:hover,
.menu-toggle:hover,
.theme-toggle:hover {
    background: var(--light);
    color: var(--secondary);
}

body.dark-mode .search-btn:hover,
body.dark-mode .menu-toggle:hover,
body.dark-mode .theme-toggle:hover {
    background: var(--gray);
}

.menu-toggle {
    display: none;
}

/* ======================================== */
/* 6. OVERLAYS (DRAWER, SEARCH, LIGHTBOX)   */
/* ======================================== */
.drawer {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    max-width: 90%;
    height: 100%;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    transition: right 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
}

.drawer.open {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray);
}

body.dark-mode .drawer-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-header h3 {
    color: var(--header-text);
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.close-drawer-btn {
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.close-drawer-btn:hover {
    color: var(--secondary);
    transform: rotate(90deg);
}

.drawer-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

.drawer-links {
    list-style: none;
}

.drawer-links li {
    margin-bottom: 0.8rem;
}

.drawer-links a {
    color: var(--steel);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--gray);
}

body.dark-mode .drawer-links a {
    color: #E6EDF5;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-links a:hover {
    color: var(--secondary);
    transform: translateX(10px);
}

.drawer-links a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(var(--white-rgb), 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

body.dark-mode .search-overlay {
    background: rgba(17, 24, 39, 0.98);
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-container {
    position: relative;
    width: 90%;
    max-width: 800px;
}

.search-overlay input {
    width: 100%;
    padding: 20px 60px 20px 30px;
    font-size: 1.8rem;
    border: none;
    border-bottom: 3px solid var(--secondary);
    background: transparent;
    color: var(--text-color);
    outline: none;
    font-family: var(--font-heading);
}

.search-overlay input::placeholder {
    color: var(--metal);
}

body.dark-mode .search-overlay input {
    color: white;
}

body.dark-mode .search-overlay input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-overlay .close-search-btn {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
}

body.dark-mode .search-overlay .close-search-btn {
    color: white;
}

.search-overlay .close-search-btn:hover {
    color: var(--secondary);
    transform: translateY(-50%) rotate(90deg);
}

.search-results-container {
    width: 90%;
    max-width: 800px;
    margin-top: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--gray);
    border-radius: 4px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    max-height: 50vh;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray);
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.3s ease;
}

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

.search-result-item:hover {
    background-color: var(--light);
}

.search-result-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-right: 1.5rem;
    background-color: #FFFFFF;
    border-radius: 4px;
    padding: 5px;
    border: 1px solid var(--gray);
}

.search-result-item .details {
    display: flex;
    flex-direction: column;
}

.search-result-item .sku {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-color);
}

.search-result-item .sku strong {
    color: var(--secondary);
    font-weight: 800;
}

.search-result-item .category {
    font-size: 0.85rem;
    color: var(--metal);
}

.search-result-item .search-result-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.search-result-item .sku {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-color);
    flex-grow: 1;
}

.search-result-price {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--secondary);
    flex-shrink: 0;
}

.search-result-preview {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: rgba(25, 118, 210, 0.05);
    border-radius: 6px;
    border-left: 2px solid var(--secondary);
}

.search-result-preview i {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-top: 0.15rem;
}

.search-result-preview span {
    font-size: 0.85rem;
    color: var(--steel);
    line-height: 1.5;
}

.search-result-preview strong {
    color: var(--secondary);
    background: rgba(25, 118, 210, 0.15);
    padding: 0.05rem 0.25rem;
    border-radius: 2px;
}

.search-status-message {
    color: var(--steel);
    padding: 2rem;
    text-align: center;
    font-size: 1.1rem;
}

body.dark-mode .search-results-container {
    background: #1F2937;
    border: 1px solid #374151;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

body.dark-mode .search-result-item {
    color: var(--text-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .search-result-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .search-result-item img {
    background-color: #2b3548;
    border: 1px solid #4b5563;
}

body.dark-mode .search-result-item .sku {
    color: var(--header-text);
}

body.dark-mode .search-result-item .sku strong {
    color: var(--accent);
}

body.dark-mode .search-result-item .category {
    color: var(--steel);
}

body.dark-mode .search-result-price {
    color: var(--accent);
}

body.dark-mode .search-result-preview {
    background: rgba(66, 165, 245, 0.08);
    border-left-color: var(--accent);
}

body.dark-mode .search-result-preview i {
    color: var(--accent);
}

body.dark-mode .search-result-preview span {
    color: rgba(255, 255, 255, 0.8);
}

body.dark-mode .search-result-preview strong {
    color: var(--accent);
    background: rgba(66, 165, 245, 0.2);
}

body.dark-mode .search-status-message {
    color: rgba(255, 255, 255, 0.7);
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.lightbox.visible {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.lightbox.visible .lightbox-content {
    transform: scale(1);
}

.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 3rem;
    z-index: 10;
}

.close-lightbox {
    position: absolute;
    top: 30px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
}

.close-lightbox:hover {
    color: var(--secondary);
    transform: rotate(90deg);
}

/* ======================================== */
/* 7. FOOTER                                */
/* ======================================== */
footer {
    background: var(--dark);
    color: white;
    padding: 5rem 5% 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    max-width: 1400px;
    margin: 0 auto 3rem;
}

.footer-column h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.footer-column p {
    color: #d1e0f0;
    margin-bottom: 1.5rem;
    line-height: 1.8;
    font-size: 1.05rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: #d1e0f0;
    text-decoration: none;
    transition: var(--transition);
    font-size: 1.05rem;
}

.footer-links a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.95rem;
}

.footer-social {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    transition: var(--transition);
}

.footer-social a:hover {
    background: var(--secondary);
    transform: translateY(-3px);
}

/* ======================================== */
/* 8. REVEAL ANIMATIONS                     */
/* ======================================== */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ======================================== */
/* 9. RESPONSIVE DESIGN                     */
/* ======================================== */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    nav ul {
        display: none;
    }

    .container {
        padding: 0 1rem;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}
