/**
 * Core Application Stylesheet
 */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #f59e0b;
    --info-color: #0284c7;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --navbar-height: 64px;
    --transition: all 0.25s ease-in-out;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Layout Structure */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: #1e293b;
    color: #cbd5e1;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: var(--transition);
}

#content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* Sidebar Collapsed State (Desktop) */
body.sidebar-collapsed #sidebar,
#sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

body.sidebar-collapsed #content-wrapper,
#sidebar.collapsed ~ #content-wrapper {
    margin-left: 0;
}

/* Top Navbar */
.top-navbar {
    height: var(--navbar-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 990;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.main-content {
    flex: 1;
    padding: 1.5rem;
}

/* Sidebar Styling */
.sidebar-brand {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    background: #0f172a;
    border-bottom: 1px solid #334155;
}

.sidebar-brand i {
    color: #38bdf8;
    margin-right: 0.6rem;
    font-size: 1.35rem;
}

.sidebar-heading {
    padding: 1rem 1.25rem 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #64748b;
}

.nav-link-item {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: var(--transition);
}

.nav-link-item i {
    font-size: 1.1rem;
    width: 24px;
    margin-right: 0.75rem;
    color: #64748b;
    transition: var(--transition);
}

.nav-link-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link-item:hover i {
    color: #38bdf8;
}

.nav-link-item.active {
    color: #ffffff;
    background: rgba(37, 99, 235, 0.15);
    border-left-color: var(--primary-color);
}

.nav-link-item.active i {
    color: #60a5fa;
}

/* Cards & Tables */
.card {
    border: 1px solid var(--border-color);
    border-radius: 0.625rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    background: var(--card-background);
}

.card-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.table th {
    font-weight: 600;
    color: #475569;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table td {
    vertical-align: middle;
    font-size: 0.92rem;
    border-bottom: 1px solid #f1f5f9;
}

/* Custom Badges */
.badge-status-paid {
    background-color: #dcfce7;
    color: #15803d;
    font-weight: 600;
}

.badge-status-partial {
    background-color: #fef9c3;
    color: #854d0e;
    font-weight: 600;
}

.badge-status-unpaid {
    background-color: #fee2e2;
    color: #b91c1c;
    font-weight: 600;
}

.badge-stock-in {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-stock-low {
    background-color: #ffedd5;
    color: #c2410c;
}

.badge-stock-out {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Quick Action Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.775rem;
    border-radius: 0.25rem;
}

/* Print Specific */
@media print {
    #sidebar, .top-navbar, .no-print, .btn, .breadcrumb, footer {
        display: none !important;
    }
    #content-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .main-content {
        padding: 0 !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
    }
}
