/* ===========================================
   PerpusPro Admin — Global Style Sheet
   Clean, non-conflicting PC + Mobile CSS
   =========================================== */

/* ----------- CSS Variables ----------- */
:root {
    --primary: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --info: #06b6d4;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --light: #f8fafc;
    --border-color: #e2e8f0;
    --sidebar-width: 250px;
}

/* ----------- Base Reset ----------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ----------- Outer Flex Wrapper ----------- */
.d-flex.min-vh-100 {
    overflow-x: hidden;
}

/* ----------- Desktop Sidebar (fixed, ≥992px only) ----------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 1000;
    flex-shrink: 0;
}

/* ----------- Admin Main Wrapper ----------- */
/* PC: pushed right by sidebar width via CSS (NOT inline style) */
@media (min-width: 992px) {
    .admin-main-wrapper {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
        min-width: 0;
    }
}

/* Mobile: full width, no offset */
@media (max-width: 991.98px) {
    .sidebar {
        display: none !important;
    }

    .admin-main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        min-width: 0;
    }
}

/* ----------- Overflow Protection (wrappers only, NOT tables) ----------- */
.admin-main-wrapper,
main,
.main-content {
    overflow-x: hidden;
    max-width: 100%;
}

/* Tables scroll horizontally inside their own wrapper */
.table-responsive,
.dataTables_wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* PHP Error boxes — don't stretch page */
div[style*="border:1px solid #990000"],
div[style*="border: 1px solid #990000"] {
    max-width: 100%;
    word-break: break-all;
    overflow-wrap: anywhere;
    white-space: normal;
}

/* ----------- Card ----------- */
.card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.08);
}

/* Premium Card Header & Buttons */
.card-header-premium {
    background: rgba(67, 97, 238, 0.05);
    border-bottom: 1px solid rgba(67, 97, 238, 0.1);
    color: var(--primary);
    padding: 1rem 1.25rem;
}

.btn-premium {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: white;
    border: none;
    font-weight: 600;
}
.btn-premium:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    color: white;
}

/* Background Light Colors (Tinted backgrounds) */
.bg-light-primary { background-color: rgba(79, 70, 229, 0.1) !important; }
.bg-light-info { background-color: rgba(6, 182, 212, 0.1) !important; }
.bg-light-success { background-color: rgba(16, 185, 129, 0.1) !important; }
.bg-light-warning { background-color: rgba(245, 158, 11, 0.1) !important; }
.bg-light-danger { background-color: rgba(239, 68, 68, 0.1) !important; }

/* Transition and Hover Utilities */
.transition-all { transition: all 0.3s ease !important; }
.hover-translate-y-n3:hover { transform: translateY(-3px) !important; }
.hover-translate-x-n3:hover { transform: translateX(-3px) !important; }

/* ----------- Sidebar Navigation ----------- */
.sidebar .nav-link {
    color: #475569;
    padding: 8px 14px;
    border-radius: 10px;
    margin: 2px 0;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.sidebar .nav-link.active {
    background: rgba(79,70,229,0.1);
    color: var(--primary);
    font-weight: 700;
}

.sidebar .nav-link i,
.sidebar .nav-link .lucide {
    margin-right: 12px;
    flex-shrink: 0;
}

.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(79,70,229,0.2);
    border-radius: 10px;
}

/* ----------- Form Controls ----------- */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
}

/* ----------- Tables ----------- */
.table {
    color: var(--dark);
    font-size: 0.88rem;
}

.table thead th {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

/* ----------- Badges ----------- */
.badge {
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* ----------- Indigo Utilities ----------- */
.bg-indigo {
    background-color: rgba(79,70,229,0.12);
    color: var(--primary);
}

.bg-indigo-solid {
    background-color: var(--primary) !important;
    color: #fff !important;
}

.badge.bg-indigo,
.badge.bg-opacity-10.text-indigo,
.badge.text-indigo,
.bg-indigo.bg-opacity-10,
.bg-indigo-subtle {
    background-color: rgba(79,70,229,0.12) !important;
    color: var(--primary) !important;
    border: 1px solid rgba(79,70,229,0.2);
}

.bg-indigo.bg-opacity-20 { background-color: rgba(79,70,229,0.2) !important; color: var(--primary) !important; }
.bg-indigo.bg-opacity-25 { background-color: rgba(79,70,229,0.25) !important; color: var(--primary) !important; }
.text-indigo   { color: var(--primary) !important; }
.border-indigo { border-color: var(--primary) !important; }

/* ----------- Buttons ----------- */
.btn-brand-primary,
.btn-primary {
    background-color: var(--primary) !important;
    color: #fff !important;
}

.btn-brand-primary:hover,
.btn-primary:hover {
    background-color: #4338ca !important;
    color: #fff !important;
}

/* ----------- Utilities ----------- */
.extra-small { font-size: 0.78rem; }
.lucide { vertical-align: middle; }

/* ----------- DataTables Fixes ----------- */
.dataTables_wrapper .dataTables_length label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_length select {
    padding: 6px 30px 6px 12px !important;
    min-width: 70px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background-position: right 8px center;
    display: inline-block;
    width: auto;
}

.dataTables_wrapper .dataTables_filter label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 6px 12px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ----------- Mobile Dropdown Center ----------- */
@media (max-width: 575.98px) {
    .dropdown-mobile-center {
        position: fixed !important;
        top: 65px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 92vw !important;
        margin: 0 !important;
    }
}

/* ----------- Form Styling Enhancements ----------- */
.form-label {
    color: #475569 !important;
    font-weight: 500 !important;
}

.form-control::placeholder,
.form-select::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
    font-weight: 400 !important;
}

.extra-small {
    font-size: 0.75rem !important;
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}
