@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
    /* Color Palette - White & Red Theme */
    --primary: #46cc1d;
    --primary-hover: #37b111;
    --primary-soft: rgba(220, 38, 38, 0.08);
    --secondary: #1e293b;
    
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-on-primary: #ffffff;
    
    --border: rgba(15, 23, 42, 0.08);
    --border-hover: rgba(15, 23, 42, 0.15);
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    
    --sidebar-w: 280px;
    --header-h: 70px;
    --radius: 0px;
    --transition: all 0.2s ease-in-out;
}

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

body {
    background: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    display: flex;
    min-height: 100vh;
    font-size: 0.95rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-heading {
    font-family: 'Outfit', sans-serif;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.animate-fade { animation: fadeIn 0.5s ease forwards; }
.animate-up { animation: fadeInUp 0.5s ease forwards; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Layout Components */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 12px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    overflow: hidden;
    transition: var(--transition);
}

.sidebar-brand {
    height: 100px;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    text-decoration: none;
    gap: 1rem;
}

.sidebar-brand-icon {
    width: 42px; height: 42px;
    background: var(--primary);
    border-radius: 0;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 4px 4px 0px rgba(220, 38, 38, 0.2);
    border: 2px solid var(--text-main);
}

.sidebar-brand-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

.sidebar-brand-name span { color: var(--primary); }

.nav-section { 
    padding: 1.5rem 1rem; 
    flex: 1;
    overflow-y: auto;
}
.nav-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 1rem;
    margin-bottom: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 4px 4px 0px rgba(220, 38, 38, 0.2);
}

.nav-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; vertical-align: middle; }
.icon-lg svg { width: 32px; height: 32px; }
.icon-sm svg { width: 16px; height: 16px; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
}
.menu-toggle svg { width: 24px; height: 24px; }

.main-wrap {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: var(--header-h);
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 2.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-title h1 { font-size: 1.25rem; font-weight: 700; }

.content-body { padding: 2.5rem; flex: 1; }

/* Cards & Components */
.card {
    animation: fadeInUp 0.5s ease forwards;
    background: var(--bg-surface);
    border: 2px solid var(--text-main);
    border-radius: 0;
    padding: 2rem;
    box-shadow: 6px 6px 0px var(--border);
    transition: var(--transition);
}

.card:hover { border-color: var(--text-main); box-shadow: 10px 10px 0px var(--border); transform: translate(-2px, -2px); }

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

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-container { 
    width: 100%;
    overflow-x: auto;
}

.stat-grid {
    animation: fadeInUp 0.5s ease forwards;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 2px solid var(--text-main);
    border-radius: 0;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
    box-shadow: 4px 4px 0px var(--border);
}

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

.stat-icon {
    width: 56px; height: 56px;
    border-radius: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    border: 2px solid currentColor;
}

.bg-red-soft { background: #fee2e2; color: #dc2626; }
.bg-blue-soft { background: #eff6ff; color: #3b82f6; }
.bg-purple-soft { background: #f5f3ff; color: #8b5cf6; }
.bg-amber-soft { background: #fffbeb; color: #f59e0b; }
.bg-emerald-soft { background: #f0fdf4; color: #16a34a; }
.bg-cyan-soft { background: #ecfeff; color: #0891b2; }

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}
.btn-primary:hover { 
    background: var(--primary-hover); 
    transform: translate(-2px, -2px); 
    box-shadow: 6px 6px 0px var(--text-main);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
}
.btn-secondary:hover { background: var(--bg-main); border-color: var(--border-hover); }

/* Forms */
.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    background: white;
    border: 2px solid var(--text-main);
    border-radius: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
    outline: none;
}

/* User Card */
.user-card {
    padding: 1.25rem;
    background: #f1f5f9;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    z-index: 10;
    flex-shrink: 0;
}

.user-avatar {
    width: 40px; height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 0;
    border: 2px solid var(--text-main);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}

.user-meta { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 0.85rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

.user-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-profile, .btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0;
    transition: var(--transition);
    color: var(--text-muted);
    text-decoration: none;
}

.btn-profile:hover, .btn-logout:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

/* Login Page Specific */
.login-body {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-wallpaper {
    position: fixed;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    filter: saturate(0.8) contrast(1.1);
    animation: kenBurns 60s linear infinite alternate;
}

@keyframes kenBurns {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

.login-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at center, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.85) 100%),
                linear-gradient(rgba(220, 38, 38, 0.05) 1px, transparent 1px),
                linear-gradient(90deg, rgba(220, 38, 38, 0.05) 1px, transparent 1px);
    background-size: auto, 50px 50px, 50px 50px;
}

.login-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 3px);
    pointer-events: none;
}

.login-card {
    background: #fff;
    width: 100%;
    max-width: 440px;
    border-radius: 0;
    padding: 3rem;
    box-shadow: 12px 12px 0px var(--primary);
    border: 3px solid var(--text-main);
}

/* Badge System */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1.5px solid currentColor;
}

.badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-draft      { background: #f1f5f9; color: #64748b; }
.badge-submitted  { background: #eff6ff; color: #3b82f6; }
.badge-confirmed  { background: #f5f3ff; color: #8b5cf6; }
.badge-processing { background: #fffbeb; color: #f59e0b; }
.badge-shipped    { background: #ecfeff; color: #0891b2; }
.badge-delivered  { background: #f0fdf4; color: #16a34a; }
.badge-cancelled  { background: #fef2f2; color: #dc2626; }
.badge-on_hold    { background: #fff7ed; color: #ea580c; }

.badge-active     { background: #f0fdf4; color: #16a34a; }
.badge-inactive   { background: #f1f5f9; color: #64748b; }
.badge-expired    { background: #fef2f2; color: #dc2626; }
.badge-maintenance { background: #fffbeb; color: #f59e0b; }
.badge-completed  { background: #f0fdf4; color: #16a34a; }
.badge-suspended  { background: #fff7ed; color: #ea580c; }

/* Tables */
.table-container { 
    width: 100%;
    overflow-x: auto; 
    border-radius: 0; 
    border: 2px solid var(--text-main); 
    box-shadow: 4px 4px 0px var(--border);
}

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

th { 
    background: #f8fafc; 
    padding: 1rem 1.25rem; 
    text-align: left; 
    font-size: 0.75rem; 
    font-weight: 700; 
    color: var(--text-muted); 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    border-bottom: 1px solid var(--border);
}

td { 
    padding: 1.25rem; 
    border-bottom: 1px solid var(--border); 
    vertical-align: middle; 
    color: var(--text-main);
    font-size: 0.9rem;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fdfdfd; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 0;
    background: white;
    border: 2px solid var(--text-main);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 800;
    font-size: 0.9rem;
    transition: var(--transition);
}

.page-link:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.page-link.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2); }
.page-link.disabled { opacity: 0.5; pointer-events: none; }

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-wrap {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-wrap .icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-wrap input {
    padding-left: 3rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.select-modern {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: white;
    border: 2px solid var(--text-main);
    border-radius: 0;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    cursor: pointer;
    transition: var(--transition);
}

.select-modern:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px var(--primary-soft); }

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    visibility: hidden;
    opacity: 0;
    transition: var(--transition);
}

.modal-overlay.open {
    visibility: visible;
    opacity: 1;
}

.modal {
    background: var(--bg-surface);
    width: 100%;
    max-width: 600px;
    border-radius: 0;
    box-shadow: 12px 12px 0px var(--secondary);
    border: 3px solid var(--text-main);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-overlay.open .modal {
    transform: translateY(0);
}

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

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover { color: var(--primary); }

.modal form {
    padding: 2rem;
    overflow-y: auto;
}

/* Utilities */
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 1rem; }
.flex-1 { flex: 1; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }

.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--text-muted); }
.fw-bold { font-weight: 700; }

.divider { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group.full-width { grid-column: span 2; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-main); margin-bottom: 0.5rem; }

.mobile-only { display: none; }
.desktop-only { display: block; }

.alert {
    padding: 1rem 1.5rem;
    border-radius: 0;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    border: 2px solid currentColor;
}

.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbfcce; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fee2e2; }

/* Layout Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.1rem;
    font-weight: 500;
}

.fw-medium { font-weight: 500; }
.text-accent { color: var(--primary); }

@media (max-width: 1024px) {
    :root { --sidebar-w: 280px; }
    .sidebar { 
        transform: translateX(-100%); 
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .sidebar-open .sidebar { transform: translateX(0); }
    
    .main-wrap { margin-left: 0; width: 100%; }
    .top-bar { padding: 0 1.5rem; justify-content: flex-start; }
    .menu-toggle { display: block; }
    
    .mobile-only { display: block; }
    .desktop-only { display: none; }
    
    .top-bar-brand {
        font-family: 'Outfit', sans-serif;
        font-size: 1.5rem;
        font-weight: 800;
        color: var(--text-main);
        letter-spacing: -0.04em;
    }
    .top-bar-brand span { color: var(--primary); }
    
    .content-body { padding: 1.5rem; }
    .form-grid { grid-template-columns: 1fr; }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }
    .top-bar-title h1 { font-size: 1.1rem; }
    .breadcrumb { font-size: 0.8rem; }
    
    .login-card {
        width: 100%;
        padding: 1.5rem;
    }
    
    .card { padding: 1.25rem; }
}
