:root {
    /* Color Palette - Premium HSL System */
    --primary-h: 199;
    --primary-s: 89%;
    --primary-l: 60%;
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-glow: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.2);

    --secondary-h: 231;
    --secondary-s: 93%;
    --secondary-l: 75%;
    --secondary: hsl(var(--secondary-h), var(--secondary-s), var(--secondary-l));

    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;

    --bg-main: #020617;
    --bg-sidebar: #0f172a;
    --bg-card: rgba(15, 23, 42, 0.6);

    --border: rgba(51, 65, 85, 0.4);
    --border-hover: rgba(56, 189, 248, 0.3);

    --text-main: #f1f5f9;
    --text-dim: #94a3b8;
    --text-muted: #64748b;

    --sidebar-width: 280px;
    --glass-blur: 16px;
    --radius-lg: 20px;
    --radius-md: 12px;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 5px var(--primary-glow);
    }

    50% {
        box-shadow: 0 0 15px var(--primary-glow);
    }

    100% {
        box-shadow: 0 0 5px var(--primary-glow);
    }
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.admin-layout {
    display: flex;
    height: 100vh;
    background: radial-gradient(circle at 70% 20%, hsla(199, 89%, 60%, 0.05), transparent 40%),
        radial-gradient(circle at 10% 80%, hsla(231, 93%, 75%, 0.03), transparent 30%);
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 3rem 2rem 2rem;
    animation: slideInLeft 0.5s ease-out;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes pulse-logo-admin {
    0% {
        filter: drop-shadow(0 0 2px var(--primary-glow));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 8px var(--primary));
        transform: scale(1.1);
    }

    100% {
        filter: drop-shadow(0 0 2px var(--primary-glow));
        transform: scale(1);
    }
}

.pulse-glow-inner {
    animation: pulse-logo-admin 3s ease-in-out infinite;
    transform-origin: center;
}

.logo-svg {
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.logo:hover .logo-svg {
    transform: rotate(15deg) scale(1.15);
}

.logo-accent {
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-label {
    padding: 1.5rem 1rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    font-weight: 800;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid transparent;
}

.nav-item i {
    width: 20px;
    height: 20px;
    transition: transform 0.3s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--primary-glow), transparent);
    color: var(--primary);
    font-weight: 700;
    border-color: rgba(56, 189, 248, 0.1);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--primary);
}

.sidebar-footer {
    padding: 2rem;
    border-top: 1px solid var(--border);
    position: relative;
}

.logout-menu {
    position: absolute;
    bottom: calc(100% - 1rem);
    left: 2rem;
    right: 2rem;
    background: #0a0b14;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.logout-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.logout-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.logout-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: all 0.3s;
    cursor: pointer;
}

.user-pill:hover {
    border-color: var(--border-hover);
    background: rgba(0, 0, 0, 0.35);
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 900;
    font-size: 1.1rem;
}

.user-info .name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Main Content Area */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.content-header {
    padding: 2.5rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(var(--glass-blur));
    position: sticky;
    top: 0;
    z-index: 90;
    border-bottom: 1px solid var(--border);
}

.content-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff, var(--text-dim));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#view-container {
    padding: 3rem 4rem 4rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Widgets & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: fadeInScale 0.5s ease-out;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-soft);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 800;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 900;
    font-family: 'Outfit', sans-serif;
    color: #fff;
    line-height: 1;
}

/* Premium Tables & Cards */
.admin-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 3rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    animation: fadeInScale 0.6s ease-out;
}

.card-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
}

.card-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1.5rem 2rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    font-weight: 800;
    letter-spacing: 1px;
}

td {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr {
    transition: background 0.2s;
}

tr:hover td {
    background: rgba(56, 189, 248, 0.02);
}

/* Typography & Content Styles */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.view-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: #020617;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 14px 0 rgba(56, 189, 248, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px 0 rgba(56, 189, 248, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    border: 1px solid var(--border);
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
}

.action-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.6rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-glow);
}

/* Status & Indicators */
.status-tag {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-active {
    background: rgba(52, 211, 153, 0.1);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.status-pending {
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.source-pill {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
}

.source-pill.ghl {
    background: rgba(129, 140, 248, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(129, 140, 248, 0.3);
}

.source-pill.woo {
    background: rgba(251, 113, 133, 0.15);
    color: #fda4af;
    border: 1px solid rgba(251, 113, 133, 0.3);
}

.source-pill.odoo {
    background: rgba(141, 78, 133, 0.15);
    color: #d4a5d0;
    border: 1px solid rgba(141, 78, 133, 0.3);
}

/* Special Layout Helpers */
.prod-name {
    font-weight: 800;
    color: #fff;
    font-size: 1.05rem;
}

.sub-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
    border: 2px solid var(--bg-main);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Form Elements */
input[type="text"],
input[type="number"],
select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--radius-md);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(1, 4, 18, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem;
    animation: modalOverlayIn 0.3s ease-out;
    overflow-y: auto;
    /* Allow overlay scroll if needed */
}

@keyframes modalOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(165deg, #0f172a, #020617);
    border: 1px solid var(--border);
    padding: 3.5rem 4rem;
    border-radius: 40px;
    width: 96vw;
    max-width: 1600px;
    min-height: 70vh;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(56, 189, 248, 0.1);
    animation: fadeInScale 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.2);
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0.8;
}

.modal-content h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 0.75rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 15px;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.75rem;
}

.input-wrapper label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 800;
}

.input-field {
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid var(--border) !important;
    padding: 1.1rem 1.25rem !important;
    border-radius: 14px !important;
    color: #fff !important;
    font-size: 0.95rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    width: 100%;
    line-height: 1.4;
}

.input-field:focus {
    border-color: var(--primary) !important;
    background: rgba(56, 189, 248, 0.05) !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.15) !important;
    transform: translateY(-1px);
    outline: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1.25rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sku-tag {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.2);
    margin-bottom: 2.5rem;
    display: inline-block;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
        /* Bottom sheet align */
    }

    .modal-content {
        max-width: 100%;
        max-height: 92vh;
        /* Prevent cutting off */
        overflow-y: auto;
        /* Enable internal scrolling */
        border-radius: 32px 32px 0 0;
        padding: 2.5rem 1.5rem 3rem;
        /* Extra bottom padding for mobile safari nav bars */
        margin-bottom: 0;
        border-bottom: none;
        animation: slideUpMobile 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .modal-grid {
        grid-template-columns: 1fr !important;
        /* Force stack on mobile */
        gap: 1rem;
    }

    .modal-actions {
        flex-direction: column-reverse;
        gap: 1rem;
        margin-top: 2.5rem;
        padding-bottom: 2rem;
    }

    .modal-actions button {
        width: 100%;
        padding: 1.25rem;
    }

    .modal-content h3 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
}