/* ==========================================================================
   FILMY MONKEY — PREMIUM CORPORATE ERP THEME
   World-Class Enterprise SaaS Design System
   ========================================================================== */

:root {
    /* ── BACKGROUNDS ── */
    --bg-page:           #F4F6F9;
    --bg-surface:        #FFFFFF;
    --bg-sidebar:        #1B2A4A;
    --bg-sidebar-active: #243561;
    --bg-table-header:   #F8FAFC;
    --bg-input:          #FFFFFF;
    --bg-input-focus:    #F8FAFF;
    --bg-modal-overlay:  rgba(15,23,42,0.5);

    /* ── PRIMARY COLORS ── */
    --primary-navy:      #1B3A6B;
    --primary-blue:      #2563EB;
    --primary-light:     #3B82F6;
    --primary-pale:      #EFF6FF;

    /* ── ACCENT COLORS ── */
    --accent-teal:       #0891B2;
    --accent-indigo:     #4F46E5;

    /* ── SEMANTIC COLORS ── */
    --success-green:     #16A34A;
    --success-light-bg:  #F0FDF4;
    --success-border:    #BBF7D0;

    --warning-amber:     #D97706;
    --warning-light-bg:  #FFFBEB;
    --warning-border:    #FDE68A;

    --danger-red:        #DC2626;
    --danger-light-bg:   #FEF2F2;
    --danger-border:     #FECACA;

    --info-blue:         #2563EB;
    --info-light-bg:     #EFF6FF;
    --info-border:       #BFDBFE;

    --neutral-purple:    #7C3AED;

    /* ── TEXT COLORS ── */
    --text-primary:      #0F172A;
    --text-secondary:    #374151;
    --text-tertiary:     #6B7280;
    --text-disabled:     #9CA3AF;
    --text-inverse:      #FFFFFF;

    /* ── BORDERS ── */
    --border-light:      #E5E7EB;
    --border-default:    #D1D5DB;
    --border-strong:     #9CA3AF;
    --border-focus:      #2563EB;
    --border-navy:       rgba(255,255,255,0.1);

    /* ── SHADOWS ── */
    --shadow-xs:         0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm:         0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:         0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg:         0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
    --shadow-xl:         0 20px 25px rgba(0,0,0,0.1), 0 8px 10px rgba(0,0,0,0.04);
    --shadow-card:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-navbar:     0 1px 0 #E5E7EB;

    /* ── GRADIENTS ── */
    --grad-header:       linear-gradient(135deg, #1B3A6B 0%, #1e4080 50%, #243561 100%);
    --grad-btn-primary:  linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    --grad-stat-accent:  linear-gradient(135deg, #1B3A6B 0%, #2563EB 100%);
    --grad-sidebar-act:  linear-gradient(90deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.04) 100%);

    /* ── TYPOGRAPHY ── */
    --font-heading:      'Plus Jakarta Sans', sans-serif;
    --font-body:         'Inter', sans-serif;
}

/* ==========================================================================
   GLOBAL RESET & TYPOGRAPHY
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    background-color: var(--bg-page);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Page Fade In Micro-interaction */
.page-content {
    animation: pageFadeIn 0.2s ease;
}
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin-top: 0;
}

h1 { letter-spacing: -0.3px; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.sv-btn-primary {
    background: var(--grad-btn-primary);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-family: var(--font-body);
    font-weight: 600;
    letter-spacing: 0.1px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1), 0 0 0 1px rgba(37,99,235,0.5);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    justify-content: center;
}
.sv-btn-primary:hover {
    background: linear-gradient(135deg, #1D4ED8 0%, #1E40AF 100%);
    box-shadow: 0 4px 12px rgba(37,99,235,0.35);
    transform: translateY(-1px);
    color: #FFFFFF;
}
.sv-btn-primary:active {
    transform: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */
.sv-form-group {
    margin-bottom: 20px;
}
.sv-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.sv-input {
    width: 100%;
    height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 0 12px;
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--text-primary);
    transition: all 0.15s;
    outline: none;
    box-shadow: var(--shadow-xs);
}
.sv-input::placeholder {
    color: var(--text-disabled);
}
.sv-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1), var(--shadow-xs);
    background: var(--bg-input-focus);
}

.sv-check {
    appearance: none;
    background-color: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    width: 16px;
    height: 16px;
    display: inline-block;
    position: relative;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-xs);
    vertical-align: middle;
    margin-top: 0;
}
.sv-check:checked {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}
.sv-check:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #FFFFFF;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ==========================================================================
   LOGIN PAGE (50/50 SPLIT)
   ========================================================================== */
.auth-split-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Left Half */
.auth-left {
    width: 50%;
    background: linear-gradient(145deg, #1B3A6B 0%, #1e4d8c 40%, #152240 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    position: relative;
}
@media (max-width: 992px) {
    .auth-left { display: none; }
    .auth-right { width: 100% !important; }
}

.auth-logo {
    width: 60px;
    height: 60px;
    color: #FFFFFF;
}
.auth-company-name {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.5px;
    margin: 16px 0 8px;
}
.auth-tagline {
    font-size: 16px;
    color: rgba(255,255,255,0.6);
    text-align: center;
    margin-bottom: 40px;
}
.auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
}
.auth-features li {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.auth-features li i {
    color: #60A5FA;
}
.auth-footer {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    position: absolute;
    bottom: 30px;
}

/* Right Half */
.auth-right {
    width: 50%;
    background: var(--bg-page);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}
.auth-login-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.auth-login-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 28px;
}

/* ==========================================================================
   LAYOUT ARCHITECTURE
   ========================================================================== */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- SIDEBAR --- */
.sv-sidebar {
    width: 256px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-navy);
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
}

.sv-sidebar-top {
    height: 64px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-navy);
    background: #152240;
}
.sv-sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    text-decoration: none;
}
.sv-sidebar-logo img {
    height: 42px;
    max-height: 46px;
    max-width: 175px;
    object-fit: contain;
    background-color: #FFFFFF;
    padding: 3px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.sv-sidebar-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
}
.sv-sidebar-close:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.2);
}

/* Sidebar Backdrop for Mobile/Tablet Drawer */
.sv-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.sv-sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.sv-sidebar-nav {
    padding: 16px 12px;
    flex-grow: 1;
    overflow-y: auto;
}

/* Custom Scrollbar for Sidebar */
.sv-sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sv-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.sv-sidebar-section {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 20px 8px 8px;
}
.sv-sidebar-section:first-child {
    padding-top: 8px;
}

.sv-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    margin-bottom: 2px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.sv-nav-item i {
    width: 18px;
    height: 18px;
    color: rgba(255,255,255,0.45);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sv-nav-label {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    white-space: nowrap;
}

/* Sidebar Hover */
.sv-nav-item:hover {
    background: rgba(255,255,255,0.07);
    text-decoration: none;
}
.sv-nav-item:hover i {
    color: rgba(255,255,255,0.75);
}
.sv-nav-item:hover .sv-nav-label {
    color: rgba(255,255,255,0.9);
}

/* Sidebar Active */
.sv-nav-item.active {
    background: var(--grad-sidebar-act);
    border-left: 3px solid var(--primary-light);
    border-radius: 0 8px 8px 0;
    margin-left: -12px;
    padding-left: 21px;
}
.sv-nav-item.active i {
    color: #60A5FA;
}
.sv-nav-item.active .sv-nav-label {
    color: #FFFFFF;
    font-weight: 600;
}

.sv-sidebar-bottom {
    padding: 16px;
    border-top: 1px solid var(--border-navy);
    background: #152240;
    display: flex;
    gap: 10px;
    align-items: center;
}
.sv-sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.sv-sidebar-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}
.sv-sidebar-user-info {
    flex-grow: 1;
    overflow: hidden;
}
.sv-sidebar-name {
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sv-sidebar-role {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
}
.sv-sidebar-settings {
    color: rgba(255,255,255,0.3);
    transition: color 0.15s ease;
    text-decoration: none;
}
.sv-sidebar-settings:hover {
    color: #FFFFFF;
}

/* --- MAIN CONTENT AREA --- */
#content-wrapper {
    margin-left: 256px;
    width: calc(100% - 256px);
    min-height: 100vh;
    background: var(--bg-page);
    display: flex;
    flex-direction: column;
}

#content {
    padding: 28px 32px;
    max-width: 1600px;
    flex-grow: 1;
}

/* --- TOP NAVBAR --- */
.sv-topbar {
    height: 60px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-navbar);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 28px;
    display: flex;
    align-items: center;
}

.sv-global-search {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sv-search-input-wrapper {
    position: relative;
}

.sv-search-input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-disabled);
    font-size: 13px;
    pointer-events: none;
}

.sv-search-input {
    width: 320px;
    height: 36px;
    background: var(--bg-page);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 0 12px 0 36px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.15s ease;
    outline: none;
}
.sv-search-input::placeholder {
    color: var(--text-disabled);
}
.sv-search-input:focus {
    background: #FFFFFF;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.sv-search-btn {
    height: 36px;
    background: #FFFFFF;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-xs);
    transition: all 0.15s;
    cursor: pointer;
}
.sv-search-btn:hover {
    background: #F9FAFB;
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* Navbar Right Icons */
.sv-topbar-icon-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    position: relative;
    cursor: pointer;
    text-decoration: none;
}
.sv-topbar-icon-btn i {
    font-size: 16px !important;
    color: var(--text-secondary) !important;
    display: inline-block;
}
.sv-topbar-icon-btn:hover {
    background: var(--bg-page);
    border-color: var(--border-default);
    color: var(--text-secondary);
}

.sv-topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-light);
    margin: 0 12px;
}

.sv-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    text-decoration: none;
}
.sv-user-btn:hover {
    background: var(--bg-page);
}
.sv-user-btn .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.sv-user-btn .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE SYSTEM (FILMY MONKEY ERP)
   ========================================================================== */

/* Tablet & Mobile Drawer (Viewport <= 991.98px) */
@media (max-width: 991.98px) {
    #wrapper {
        overflow-x: hidden;
    }
    
    .sv-sidebar {
        left: -285px;
        width: 275px;
        box-shadow: 12px 0 36px rgba(0, 0, 0, 0.4);
    }
    
    .sv-sidebar.show {
        left: 0 !important;
    }
    
    #content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;
    }
    
    .sv-topbar {
        padding: 0 16px;
    }
    
    #content {
        padding: 20px 16px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
}

/* Mobile Devices (Viewport <= 767.98px) */
@media (max-width: 767.98px) {
    #content {
        padding: 14px 10px;
    }
    
    .sv-topbar {
        height: 56px;
        padding: 0 12px;
    }
    
    /* Touch optimization */
    .sv-nav-item {
        padding: 12px 14px;
        margin-bottom: 4px;
    }
    
    .sv-nav-label {
        font-size: 14px;
    }
    
    /* Headers & Actions wrapping */
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }
    
    .d-flex.justify-content-between.align-items-center > * {
        width: 100%;
    }
    
    .quick-btn {
        flex: 1 1 calc(50% - 6px);
        font-size: 12px;
        padding: 8px 10px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Form inputs mobile styling - 16px prevents iOS Safari auto zoom */
    .sv-input,
    .form-control,
    .form-select,
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
        min-height: 42px;
    }
    
    /* Table responsiveness & smooth touch scrolling */
    .table-responsive {
        border: 1px solid var(--border-light);
        border-radius: 8px;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        background: #FFFFFF;
        box-shadow: var(--shadow-xs);
    }
    
    .table {
        margin-bottom: 0;
    }
    
    .table th, .table td {
        padding: 10px 12px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    /* DataTables Mobile Controls */
    div.dataTables_wrapper div.dataTables_length,
    div.dataTables_wrapper div.dataTables_filter {
        text-align: left !important;
        margin-bottom: 10px;
        width: 100%;
    }
    
    div.dataTables_wrapper div.dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        display: block;
        margin-top: 4px;
    }
    
    div.dataTables_wrapper div.dataTables_info,
    div.dataTables_wrapper div.dataTables_paginate {
        text-align: center !important;
        margin-top: 10px;
    }
    
    .dt-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 12px;
        width: 100%;
    }
    
    .dt-buttons .btn {
        flex: 1 1 calc(33% - 6px);
        font-size: 11px !important;
        padding: 6px 8px !important;
    }
    
    /* Stat cards on mobile */
    .stat-card .card-body {
        padding: 14px 16px;
    }
    
    .stat-value {
        font-size: 1.3rem !important;
    }
    
    .stat-icon {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.1rem !important;
    }
    
    /* Modals for Mobile */
    .modal-dialog {
        margin: 10px auto;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding: 14px 16px;
    }
}

/* Extra Small Phones (Viewport <= 575.98px) */
@media (max-width: 575.98px) {
    .sv-sidebar {
        width: 82vw;
        max-width: 290px;
        left: -86vw;
    }
    
    .sv-sidebar.show {
        left: 0 !important;
    }
    
    .dropdown-menu-end {
        right: 0 !important;
        left: auto !important;
        max-width: 95vw !important;
    }
    
    .btn {
        font-size: 13px;
    }
}
