/* ============================================
   ZERO CONSTRUCTIONS ERP - Global Styles
   ============================================ */

:root {
    --primary-blue: #0A156B;
    --primary-orange: #FF8400;
    --bg-color: #F5F7FA;
    --card-bg: #FFFFFF;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 60px;
    --header-height: 56px;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: #333;
    overflow-x: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0A156B 0%, #0D1B8A 100%);
    transition: width 0.3s ease;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.sidebar .sidebar-brand {
    background: rgba(0,0,0,0.1);
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.7);
    padding: 10px 12px;
    border-radius: 8px;
    margin: 2px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

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

.sidebar .nav-link.active {
    color: #fff;
    background: var(--primary-orange);
    box-shadow: 0 2px 8px rgba(255,132,0,0.3);
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar .nav-link span {
    white-space: nowrap;
}

/* Sidebar collapsed */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-user div:last-child,
.sidebar.collapsed .sidebar-brand span {
    display: none;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 10px;
}

/* ============================================
   PAGE CONTENT
   ============================================ */
#page-content-wrapper {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-width: 0;
}

.sidebar.collapsed + #page-content-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid #e9ecef;
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar .nav-link {
    color: #555;
    padding: 0.5rem;
}

.topbar .nav-link:hover {
    color: var(--primary-blue);
}

/* ============================================
   AVATARS
   ============================================ */
.avatar-sm, .avatar-xs {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-orange);
    color: #fff;
    font-weight: 600;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.avatar-xs {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-initials-sm {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    background: var(--card-bg);
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
    border-left: 4px solid var(--primary-orange);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.btn-primary:hover {
    background-color: #0c1a7e;
    border-color: #0c1a7e;
}

.btn-orange {
    background-color: var(--primary-orange);
    border-color: var(--primary-orange);
    color: #fff;
}

.btn-orange:hover {
    background-color: #e67600;
    border-color: #e67600;
    color: #fff;
}

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

.btn-outline-orange:hover {
    background-color: var(--primary-orange);
    color: #fff;
}

/* ============================================
   TABLES
   ============================================ */
.table th {
    background: #f8f9fc;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
    border-bottom: 2px solid #e9ecef;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.375rem 0.75rem;
}

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 0.2rem rgba(10,21,107,0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #444;
    margin-bottom: 0.3rem;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    line-height: 1;
    min-width: 18px;
    text-align: center;
}

.notif-dropdown {
    width: 350px;
    max-height: 400px;
}

.notif-list {
    max-height: 300px;
    overflow-y: auto;
}

.notif-item {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.notif-item:hover {
    background: #f8f9fc;
}

.notif-item.unread {
    border-left: 3px solid var(--primary-orange);
    background: #fff8f0;
}

/* ============================================
   MODALS
   ============================================ */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 1rem 1.5rem;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* ============================================
   PROGRESS
   ============================================ */
.progress {
    border-radius: 10px;
    background: #e9ecef;
    height: 8px;
}

.progress-bar {
    border-radius: 10px;
}

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0A156B 0%, #1a2a8a 50%, #0A156B 100%);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: 16px;
    overflow: hidden;
}

.auth-card .card-body {
    padding: 2rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo h3 {
    color: var(--primary-blue);
    font-weight: 700;
}

.auth-logo p {
    color: #6c757d;
    font-size: 0.9rem;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--card-bg);
    border-top: 1px solid #e9ecef;
    color: #6c757d;
}

/* ============================================
   GANTT / TIMELINE
   ============================================ */
.gantt-container {
    overflow-x: auto;
    position: relative;
}

.gantt-bar {
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    position: absolute;
    cursor: pointer;
    transition: opacity 0.2s;
}

.gantt-bar:hover {
    opacity: 0.85;
}

/* ============================================
   DASHBOARD WIDGETS
   ============================================ */
.widget-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .sidebar, .topbar, .footer, .no-print {
        display: none !important;
    }
    #page-content-wrapper {
        margin-left: 0 !important;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.show {
        margin-left: 0;
    }
    #page-content-wrapper {
        margin-left: 0 !important;
    }
    .stat-card .stat-value {
        font-size: 1.25rem;
    }
}

/* ============================================
   UTILITY
   ============================================ */
.cursor-pointer {
    cursor: pointer;
}

.text-orange {
    color: var(--primary-orange);
}

.bg-orange {
    background-color: var(--primary-orange);
}

.border-left-orange {
    border-left: 4px solid var(--primary-orange);
}

.border-left-blue {
    border-left: 4px solid var(--primary-blue);
}

.shadow-hover:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.transition-all {
    transition: all 0.3s ease;
}

/* Select2 overrides */
.select2-container--bootstrap-5 .select2-selection {
    border-radius: 8px !important;
    min-height: 38px;
}

/* SweetAlert2 overrides */
.swal2-popup {
    border-radius: 12px !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
