/* ==========================================================================
   ManageOffice Premium Theme
   Inspired by Stripe, Linear, Notion
   ========================================================================== */

/* --- Variables --- */
:root {
    /* Colors - Indigo / Slate Palette */
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --secondary-color: #64748b;
    /* Slate 500 */

    --bg-body: #f3f4f6;
    /* Gray 100 */
    --bg-surface: #ffffff;

    --text-main: #111827;
    /* Gray 900 */
    --text-muted: #6b7280;
    /* Gray 500 */
    --text-light: #9ca3af;
    /* Gray 400 */

    --border-color: #e5e7eb;
    /* Gray 200 */
    --border-focus: #c7d2fe;
    /* Indigo 200 */
    --ring-focus: rgba(79, 70, 229, 0.25);

    --sidebar-bg: #0f172a;
    /* Slate 900 */
    --sidebar-text: #cbd5e1;
    /* Slate 300 */
    --sidebar-active-bg: #1e293b;
    /* Slate 800 */
    --sidebar-active-text: #ffffff;

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

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    /* 8px */
    --radius-lg: 0.75rem;
    /* 12px */

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --transition-speed: 200ms;
}

/* --- Global Reset & Typography --- */
body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

h1 {
    font-size: 1.875rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 500;
}

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

a:hover {
    color: var(--primary-hover);
}

/* --- UI Components --- */

/* Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-speed);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

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

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-speed);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary,
.btn-light {
    background-color: white;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover,
.btn-light:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    color: var(--text-main);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

/* Forms */
.form-control,
.form-select {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: #fff;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--ring-focus);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-main);
    margin-bottom: 0.375rem;
}

/* Tables */
.table {
    width: 100%;
    margin-bottom: 1rem;
    vertical-align: top;
    border-color: var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background-color: #f9fafb;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

.table td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

.table-hover tbody tr:hover {
    background-color: #f9fafb;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: var(--radius-sm);
    font-size: 0.75em;
}

/* --- Layout: Sidebar System --- */
#wrapper {
    overflow-x: hidden;
}

#sidebar {
    min-height: 100vh;
    margin-left: -250px;
    /* Start hidden on mobile */
    background-color: var(--sidebar-bg);
    transition: margin 0.25s ease-out;
    z-index: 1000;
    position: fixed;
    /* Stick by default on desktop if needed, or flex */
    top: 0;
    bottom: 0;
    left: 0;
    width: 250px;
}

#sidebar .sidebar-heading {
    padding: 1.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition-speed);
}

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

#sidebar .nav-link.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--primary-color);
}

#sidebar .nav-link i {
    margin-right: 0.75rem;
    opacity: 0.8;
}

#page-content-wrapper {
    width: 100%;
    transition: margin 0.25s ease-out;
}

/* Sidebar behavior */
@media (min-width: 992px) {
    #sidebar {
        margin-left: 0;
        /* Show on desktop */
        position: fixed;
        height: 100vh;
    }

    #page-content-wrapper {
        margin-left: 250px;
        /* Push content */
        width: calc(100% - 250px);
    }
}

@media (max-width: 991.98px) {
    #sidebar {
        margin-left: -250px;
    }

    #page-content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    /* Active state for mobile toggle */
    body.sb-sidenav-toggled #sidebar {
        margin-left: 0;
    }

    body.sb-sidenav-toggled #page-content-wrapper {
        margin-left: 0;
        /* Overlay or push? Overlay is better for mobile usually, but push is easier. Let's start with overlay behavior implies different z-index */
        /* If we want overlay: */
        /* margin-left: 0; */
    }
}


/* Topbar */
.top-navbar {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    padding: 0.75rem 1.5rem;
    z-index: 10;
}

/* Utilities */
.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.shadow-card {
    box-shadow: var(--shadow-md);
}

.rounded-xl {
    border-radius: var(--radius-lg);
}

/* Transitions */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

/* Overlay for mobile sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 900;
    /* Behind sidebar (1000) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

body.sb-sidenav-toggled .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 992px) {
    .sidebar-overlay {
        display: none !important;
    }
}