/* id.codes - Main Stylesheet */
/* id.codes Branding - Pink/Purple Theme */

/* =============================================================================
   CSS Variables
   ============================================================================= */
:root {
    /* Brand Colors - id.codes Pink */
    --primary: #D41A75;
    --primary-dark: #B31563;
    --primary-light: #F8E5EF;
    --primary-rgb: 212, 26, 117;
    --accent: #8B1E5C;

    /* Secondary/Neutral */
    --secondary: #64748b;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Slate Neutral Scale */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    /* Semantic Mappings */
    --bg: var(--slate-50);
    --bg-white: #ffffff;
    --text: var(--slate-800);
    --text-muted: var(--slate-500);
    --border: var(--slate-200);

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* =============================================================================
   Reset & Base
   ============================================================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
}

/* =============================================================================
   Navigation
   ============================================================================= */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    height: 64px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
}

.brand-logo:hover {
    text-decoration: none;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.nav-company {
    color: var(--text-muted);
    font-size: 0.875rem;
    padding-left: var(--space-4);
    border-left: 1px solid var(--border);
}

.nav-links {
    display: flex;
    gap: var(--space-1);
}

.nav-links a {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    color: var(--slate-600);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition);
}

.nav-links a:hover {
    background: var(--slate-100);
    color: var(--text);
    text-decoration: none;
}

.nav-links a.active {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

.nav-builder-link {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white !important;
}

.nav-builder-link:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--accent) 100%) !important;
    color: white !important;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--slate-700);
}

.user-role {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.btn-logout {
    padding: var(--space-2) var(--space-3);
    background: var(--slate-100);
    border-radius: var(--radius);
    color: var(--slate-600);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all var(--transition);
}

.btn-logout:hover {
    background: var(--slate-200);
    color: var(--slate-700);
    text-decoration: none;
}

/* =============================================================================
   Configuration Hub Tabs
   ============================================================================= */
.config-tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    background: #fff;
    border-bottom: 1px solid var(--border, #e2e8f0);
    margin: -24px -24px 24px -24px;
    padding-top: 0;
}

.config-tab {
    padding: 12px 16px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--slate-500, #64748b);
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.config-tab:hover {
    color: var(--text, #1e293b);
    text-decoration: none;
    background: var(--slate-50, #f8fafc);
}

.config-tab.active {
    color: var(--primary, #2563eb);
    border-bottom-color: var(--primary, #2563eb);
    font-weight: 600;
}

/* =============================================================================
   Container & Layout
   ============================================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 2px rgba(212, 26, 117, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(212, 26, 117, 0.3);
}

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

.btn-secondary:hover {
    background: var(--slate-50);
    border-color: var(--slate-300);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: var(--slate-600);
}

.btn-ghost:hover {
    background: var(--slate-100);
    color: var(--slate-700);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: 0.8125rem;
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--slate-700);
}

.btn-outline:hover {
    background: var(--slate-50);
    border-color: var(--slate-300);
}

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

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

/* =============================================================================
   Forms
   ============================================================================= */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-error {
    display: block;
    margin-top: 4px;
    color: var(--danger);
    font-size: 0.8125rem;
}

.form-help {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    width: 16px;
    height: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-container {
    max-width: 600px;
}

.form-card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.inline-form {
    display: inline;
}

/* =============================================================================
   Auth Pages
   ============================================================================= */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-card {
    background: var(--bg-white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-muted);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* =============================================================================
   Tables
   ============================================================================= */
.data-table {
    width: 100%;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table th,
.data-table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th {
    background: var(--slate-50);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--slate-500);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--slate-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .actions {
    display: flex;
    gap: var(--space-1);
    flex-wrap: wrap;
}

.data-table code {
    font-size: 0.8125rem;
    background: var(--slate-100);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-weight: 500;
    white-space: nowrap;
}

.row-inactive {
    opacity: 0.6;
}

/* =============================================================================
   Badges
   ============================================================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-secondary {
    background: var(--slate-100);
    color: var(--slate-600);
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}

.badge-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.badge-info {
    background: var(--info-light);
    color: #1e40af;
}

/* =============================================================================
   Stats Grid - Dashboard
   ============================================================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-white);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-content {
    text-align: center;
}

.stat-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-3);
    background: var(--primary-light);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.stat-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--slate-700);
    margin-top: var(--space-2);
}

.stat-sublabel {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.stat-plan {
    color: var(--success);
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    padding: var(--space-6) var(--space-8);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.welcome-banner h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.welcome-banner p {
    font-size: 1rem;
    opacity: 0.9;
}

/* =============================================================================
   Sections / Cards
   ============================================================================= */
.section {
    background: var(--bg-white);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: var(--space-6);
}

.section h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-4);
    color: var(--slate-800);
}

.section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-600);
    margin-bottom: var(--space-3);
}

.action-buttons {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-6);
    color: var(--text-muted);
}

.empty-state h2 {
    font-size: 1.25rem;
    color: var(--slate-700);
    margin-bottom: var(--space-2);
}

.empty-state p {
    margin-bottom: var(--space-4);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    background: var(--slate-100);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon svg {
    width: 32px;
    height: 32px;
    color: var(--slate-400);
}

.link-more {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-4);
    color: var(--primary);
    font-weight: 500;
    font-size: 0.875rem;
}

.link-more:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

/* Two-column layout for dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

/* URL Display Box */
.url-display {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--slate-50);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: var(--space-3) 0;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
}

.url-display code {
    flex: 1;
    background: none;
    color: var(--primary);
    padding: 0;
}

.btn-copy {
    padding: var(--space-1) var(--space-2);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--slate-500);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-copy:hover {
    background: var(--slate-100);
    color: var(--slate-700);
}

/* =============================================================================
   Config Page
   ============================================================================= */
.config-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.config-panel {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.config-panel h2 {
    font-size: 1.125rem;
    margin-bottom: 8px;
}

.section-list {
    min-height: 200px;
}

.section-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.section-item.active {
    background: #dbeafe;
}

.section-item.dragging {
    opacity: 0.5;
}

.drag-handle {
    cursor: move;
    color: var(--text-muted);
    margin-right: 12px;
}

.section-actions {
    display: flex;
    gap: 8px;
}

.config-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.save-status {
    font-size: 0.875rem;
}

.save-status.unsaved {
    color: var(--warning);
}

.save-status.saved {
    color: var(--success);
}

.btn-add {
    background: var(--success);
    color: white;
}

/* =============================================================================
   Detail Cards
   ============================================================================= */
.detail-card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.detail-card h2 {
    font-size: 1.125rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.detail-card.highlight {
    border: 2px solid var(--primary);
}

.detail-list {
    display: grid;
    grid-template-columns: minmax(140px, auto) 1fr;
    gap: 8px 16px;
    align-items: baseline;
}

.detail-list dt {
    color: var(--text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
}

.detail-list dd {
    font-weight: 500;
    word-break: break-word;
}

.url-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.url-box code {
    flex: 1;
    background: none;
}

.url-display {
    display: block;
    background: var(--bg);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 8px 0;
}

/* =============================================================================
   Help Section
   ============================================================================= */
.help-section {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    padding: 20px;
    border-radius: var(--radius);
    margin-top: 24px;
}

.help-section h3 {
    color: #0369a1;
    margin-bottom: 12px;
}

.help-section ul,
.help-section ol {
    margin-left: 20px;
}

.help-section li {
    margin-bottom: 8px;
}

.help-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.empty-text {
    color: var(--text-muted);
    font-style: italic;
    padding: 16px;
    text-align: center;
}

/* =============================================================================
   Flash Messages
   ============================================================================= */
.flash-messages {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.flash-success {
    background: #d1fae5;
    color: #065f46;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.flash-warning {
    background: #fef3c7;
    color: #92400e;
}

.flash-info {
    background: #dbeafe;
    color: #1e40af;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
}

.flash-close:hover {
    opacity: 1;
}

/* =============================================================================
   Error Pages
   ============================================================================= */
.error-page {
    text-align: center;
    padding: 80px 20px;
}

.error-page h1 {
    font-size: 6rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.error-page h2 {
    margin-bottom: 16px;
}

.error-page p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* =============================================================================
   Footer
   ============================================================================= */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
    margin-top: 48px;
}

/* =============================================================================
   Landing Page
   ============================================================================= */
.landing-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.landing-container {
    text-align: center;
    color: white;
    padding: 40px;
}

.landing-header h1 {
    font-size: 3rem;
    margin-bottom: 8px;
}

.tagline {
    font-size: 1.25rem;
    opacity: 0.9;
}

.landing-content {
    margin: 40px 0;
}

.landing-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 24px;
}

.landing-features {
    display: flex;
    gap: 32px;
    justify-content: center;
    margin-top: 60px;
}

.feature {
    max-width: 200px;
}

.feature h3 {
    margin-bottom: 8px;
}

.feature p {
    opacity: 0.8;
    font-size: 0.875rem;
}

.landing-footer {
    margin-top: 60px;
    opacity: 0.7;
}

/* =============================================================================
   Pagination
   ============================================================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}

.page-info {
    color: var(--text-muted);
}

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 12px;
        gap: 12px;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .config-container {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .landing-features {
        flex-direction: column;
        align-items: center;
    }
}

/* =============================================================================
   Section Builder Enhancement
   ============================================================================= */

/* Visually hidden but accessible */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Section Builder Container */
.section-builder {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    margin-bottom: 24px;
    min-height: 500px;
}

/* Panels */
.panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.panel-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.panel-available .panel-count {
    background: var(--secondary);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* Available Sections Grid */
.section-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Available Section Card (compact) */
.available-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.available-card:hover {
    background: var(--bg-white);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.available-card .section-icon-small {
    width: 36px;
    height: 36px;
    padding: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.available-card .section-icon-small svg {
    width: 100%;
    height: 100%;
}

.available-card .section-info {
    flex: 1;
    min-width: 0;
}

.available-card .section-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
}

.available-card .section-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.btn-add-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: var(--success);
    color: white;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add-icon:hover {
    background: #059669;
    transform: scale(1.1);
}

/* Active Sections List */
.section-list {
    min-height: 200px;
}

/* Active Section Card (full) */
.active-card {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.active-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow);
}

.active-card.sortable-ghost {
    opacity: 0.4;
    background: #dbeafe;
}

.active-card.sortable-chosen {
    box-shadow: var(--shadow-lg);
}

.active-card.is-expanded {
    border-color: var(--primary);
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: grab;
    background: var(--bg-white);
}

.card-header:active {
    cursor: grabbing;
}

.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    color: var(--text-muted);
    opacity: 0.4;
    transition: opacity 0.2s;
}

.active-card:hover .drag-handle {
    opacity: 1;
}

.section-icon {
    width: 44px;
    height: 44px;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius);
    color: white;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-icon svg {
    width: 100%;
    height: 100%;
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--bg);
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.field-badge.has-fields {
    background: #d1fae5;
    color: #065f46;
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: 8px;
}

.btn-expand {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.btn-expand:hover {
    background: var(--border);
    color: var(--text);
}

.btn-expand svg {
    transition: transform 0.3s ease;
}

.active-card.is-expanded .btn-expand svg {
    transform: rotate(180deg);
}

/* Inline Field Editor */
.field-editor {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--bg);
    border-top: 1px solid transparent;
}

.active-card.is-expanded .field-editor {
    max-height: 800px;
    border-top-color: var(--border);
}

.field-editor-content {
    padding: 20px;
}

.field-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.field-editor-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

/* Field List */
.field-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr 140px 40px 36px;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.field-row input[type="text"],
.field-row select {
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-white);
}

.field-row input[type="text"]:focus,
.field-row select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.field-row select {
    padding-right: 28px;
    cursor: pointer;
}

.field-row .required-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.field-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.btn-remove-field {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove-field:hover {
    background: #fee2e2;
    border-color: var(--danger);
    color: var(--danger);
}

/* Field Headers */
.field-headers {
    display: grid;
    grid-template-columns: 1fr 1fr 140px 40px 36px;
    gap: 8px;
    padding: 0 12px;
    margin-bottom: 8px;
}

.field-headers span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Suggested Fields */
.suggested-fields {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

.suggested-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: block;
}

.suggested-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-suggested {
    padding: 5px 12px;
    font-size: 0.75rem;
    background: var(--bg-white);
    border: 1px dashed var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
}

.btn-suggested:hover {
    border-style: solid;
    border-color: var(--primary);
    background: #dbeafe;
    color: var(--primary);
}

.btn-suggested.added {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Remove Section Button */
.btn-remove-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    margin-top: 16px;
    background: transparent;
    border: 1px dashed var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove-section:hover {
    background: #fee2e2;
    border-style: solid;
}

/* Sortable Hint (empty state) */
.sortable-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    margin: 12px;
    padding: 40px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    text-align: center;
}

.sortable-hint svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.sortable-hint p {
    margin: 0;
    font-size: 0.9375rem;
}

.sortable-hint span {
    font-size: 0.8125rem;
    margin-top: 4px;
}

/* Builder Actions */
.builder-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.save-status.saving {
    color: var(--warning);
}

.save-status.error {
    color: var(--danger);
}

/* Help Banner */
.config-help-banner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.config-help-banner svg {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.config-help-banner h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.config-help-banner p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

/* Responsive - Section Builder */
@media (max-width: 900px) {
    .section-builder {
        grid-template-columns: 1fr;
    }

    .panel-available {
        order: 2;
    }

    .panel-active {
        order: 1;
    }

    .section-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .section-grid {
        grid-template-columns: 1fr;
    }

    .field-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .field-row .required-toggle,
    .field-row .btn-remove-field {
        grid-column: span 1;
    }

    .field-headers {
        display: none;
    }

    .builder-actions {
        flex-direction: column;
        gap: 12px;
    }

    .builder-actions .btn {
        width: 100%;
    }
}

/* =============================================================================
   Products Page - Filter Bar & Sortable Table
   ============================================================================= */

/* Filter Bar */
.filter-bar {
    background: var(--bg-white);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group .form-control {
    min-width: 120px;
    padding: 8px 12px;
    font-size: 0.875rem;
}

.filter-group select.form-control {
    padding-right: 28px;
    cursor: pointer;
}

.filter-group input[type="date"].form-control {
    min-width: 140px;
}

.filter-search {
    flex: 1;
    min-width: 200px;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.filter-search .form-control {
    flex: 1;
}

.btn-search {
    padding: 8px 16px;
    white-space: nowrap;
}

.btn-clear-filters {
    margin-left: auto;
    padding: 8px 16px;
    white-space: nowrap;
}

/* Sortable Table */
.sortable-table th a.sortable {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.sortable-table th a.sortable:hover {
    color: var(--primary);
    text-decoration: none;
}

.sortable-table th a.sortable.sorted {
    color: var(--primary);
    font-weight: 700;
}

.sort-icon {
    font-size: 0.75rem;
    opacity: 0.7;
}

.sortable-table th a.sortable.sorted .sort-icon {
    opacity: 1;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Form Sections */
.form-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h2 {
    font-size: 1.125rem;
    margin-bottom: 16px;
}

.form-section h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin: 16px 0 12px 0;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.form-section h3:first-of-type {
    padding-top: 0;
    border-top: none;
    margin-top: 0;
}

/* Form Control Static (read-only display) */
.form-control-static {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.form-control-static code {
    font-size: 1rem;
}

.form-control-static .help-text {
    font-size: 0.8125rem;
    font-style: italic;
}

/* Required Indicator */
.required {
    color: var(--danger);
}

/* Section Fields */
.section-fields {
    margin-bottom: 24px;
}

/* Alert boxes */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.alert-info {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

.alert-info a {
    color: #1e40af;
    text-decoration: underline;
}

/* =============================================================================
   Products Page - View Toggle & SKU Cards
   ============================================================================= */

/* View Toggle */
.view-toggle {
    display: inline-flex;
    background: var(--slate-100);
    border-radius: var(--radius);
    padding: var(--space-1);
    gap: var(--space-1);
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--slate-600);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.view-toggle-btn:hover {
    color: var(--slate-800);
}

.view-toggle-btn.active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.view-toggle-btn svg {
    width: 16px;
    height: 16px;
}

/* Products Controls Bar */
.products-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.products-count {
    font-size: 0.875rem;
    color: var(--slate-600);
}

.products-count strong {
    color: var(--slate-800);
}

/* SKU Cards Grid */
.sku-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* SKU Card */
.sku-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.sku-card:hover {
    border-color: var(--slate-300);
    box-shadow: var(--shadow);
}

.sku-card.expanded {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.sku-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    user-select: none;
}

.sku-card-header:hover {
    background: var(--slate-50);
}

.sku-expand-icon {
    width: 20px;
    height: 20px;
    color: var(--slate-400);
    transition: transform var(--transition);
}

.sku-card.expanded .sku-expand-icon {
    transform: rotate(90deg);
    color: var(--primary);
}

.sku-info {
    flex: 1;
    min-width: 0;
}

.sku-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-1);
}

.sku-code {
    font-weight: 600;
    font-size: 1rem;
    color: var(--slate-800);
    font-family: 'Monaco', 'Consolas', monospace;
}

.sku-name {
    font-size: 0.875rem;
    color: var(--slate-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sku-stats {
    display: flex;
    gap: var(--space-4);
}

.sku-stat {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.8125rem;
    color: var(--slate-500);
}

.sku-stat-value {
    font-weight: 600;
    color: var(--slate-700);
}

.sku-stat.published .sku-stat-value {
    color: var(--success);
}

.sku-actions {
    display: flex;
    gap: var(--space-2);
}

/* SKU Variants (Expanded Content) */
.sku-variants {
    display: none;
    border-top: 1px solid var(--border);
    background: var(--slate-50);
}

.sku-card.expanded .sku-variants {
    display: block;
}

.sku-variants-header {
    display: grid;
    grid-template-columns: 180px 120px 100px 80px 80px 100px 1fr;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-5);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--slate-500);
    background: var(--slate-100);
    border-bottom: 1px solid var(--border);
}

.sku-variant-row {
    display: grid;
    grid-template-columns: 180px 120px 100px 80px 80px 100px 1fr;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    align-items: center;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.sku-variant-row:last-child {
    border-bottom: none;
}

.sku-variant-row:hover {
    background: var(--bg-white);
}

.variant-dpp-id {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.8125rem;
    color: var(--primary);
}

.variant-batch {
    font-size: 0.875rem;
    color: var(--slate-700);
}

.variant-gtin {
    font-size: 0.8125rem;
    color: var(--slate-600);
}

.variant-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

/* Updated filter bar styling */
.filter-bar {
    background: var(--bg-white);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: var(--space-4);
}

/* Active Filters Pills */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--primary-light);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    color: var(--primary);
}

.filter-pill-remove {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
}

.filter-pill-remove:hover {
    background: var(--primary-dark);
}

/* Responsive - Filter Bar */
@media (max-width: 900px) {
    .filter-form {
        flex-direction: column;
        gap: 12px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-search {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-clear-filters {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    .header-actions .btn {
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }

    /* Dashboard responsive */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .welcome-banner {
        padding: var(--space-5);
    }

    .welcome-banner h1 {
        font-size: 1.375rem;
    }

    /* Navigation responsive */
    .navbar {
        flex-direction: column;
        height: auto;
        padding: var(--space-3);
        gap: var(--space-3);
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-company {
        border-left: none;
        padding-left: 0;
    }

    /* SKU Cards responsive */
    .sku-variants-header,
    .sku-variant-row {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
    }

    .sku-card-header {
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    .sku-stats {
        width: 100%;
        justify-content: flex-start;
    }

    .sku-actions {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: var(--space-4);
    }

    .stat-value {
        font-size: 2rem;
    }
}
