/* AdminLTE 3 Custom Branding & SaaS Refinements */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #4e73df;
    --primary-hover: #2e59d9;
    --primary-light: #f8f9fc;
    
    --surface: #ffffff;
    --background: #f4f6f9;
    --border: #dee2e6;
    
    --text-main: #1e293b;
    --text-muted: #6c757d;
}

/* Base Overrides */
body {
    font-family: 'Inter', sans-serif !important;
    font-size: 0.875rem !important;
    color: var(--text-main) !important;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
    color: #1e293b !important;
}

/* Sidebar Branding */
.main-sidebar {
    box-shadow: 0 10px 30px 0 rgba(24, 28, 33, 0.05) !important;
}

.brand-link {
    border-bottom: 1px solid #4b545c !important;
    padding: 0.8125rem 1rem !important;
}

.brand-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800 !important;
    letter-spacing: 0.5px;
}

/* Navbar Enhancements */
.main-header {
    border-bottom: 1px solid #ebedf2 !important;
}

/* Card/Box Refinements */
.card {
    border-radius: 0.75rem !important;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2) !important;
    margin-bottom: 1.5rem;
    border: none !important;
}

.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(0,0,0,.125) !important;
    padding: 0.75rem 1.25rem !important;
}

.card-title {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
}

/* Table Density */
.table thead th {
    background-color: #f8f9fc;
    color: #4e73df;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    font-weight: 700;
    border-top: none !important;
}

.table td {
    vertical-align: middle !important;
    padding: 0.75rem !important;
}

/* Buttons */
.btn {
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 0.35rem;
}

.btn-xs {
    padding: 0.125rem 0.4rem;
    font-size: 0.7rem;
    border-radius: 0.25rem;
}

.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 6px -1px rgba(78, 115, 223, 0.1), 0 2px 4px -1px rgba(78, 115, 223, 0.06);
}

.btn-primary:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(78, 115, 223, 0.2);
}

/* CRM Action Buttons - Beautiful & Small */
.btn-crm-view, .btn-crm-edit, .btn-crm-delete {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s;
    border: 1px solid transparent;
    margin: 0 2px;
}

.btn-crm-view {
    background-color: #e0f2fe;
    color: #0369a1;
}

.btn-crm-view:hover {
    background-color: #0369a1;
    color: #ffffff;
    transform: scale(1.1);
}

.btn-crm-edit {
    background-color: #f0f9ff;
    color: #0284c7;
    border-color: #e0f2fe;
}

.btn-crm-edit:hover {
    background-color: #0284c7;
    color: #ffffff;
    transform: scale(1.1);
}

.btn-crm-delete {
    background-color: #fff1f2;
    color: #be123c;
}

.btn-crm-delete:hover {
    background-color: #be123c;
    color: #ffffff;
    transform: scale(1.1);
}

.btn-crm-approve, .btn-crm-reject {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s;
    border: 1px solid transparent;
    margin: 0 2px;
}

.btn-crm-approve {
    background-color: #f0fdf4;
    color: #15803d;
    border-color: #dcfce7;
}

.btn-crm-approve:hover {
    background-color: #15803d;
    color: #ffffff;
    transform: scale(1.1);
}

.btn-crm-reject {
    background-color: #fff1f2;
    color: #be123c;
    border-color: #ffe4e6;
}

.btn-crm-reject:hover {
    background-color: #be123c;
    color: #ffffff;
    transform: scale(1.1);
}

.btn-crm-action {
    background-color: #eef2ff;
    color: #4f46e5;
    border-color: #e0e7ff;
}

.btn-crm-action:hover {
    background-color: #4f46e5;
    color: #ffffff;
    transform: scale(1.1);
}

/* Form Controls & Select2 Integration */
.form-control, .form-select, .select2-container--bootstrap4 .select2-selection {
    height: calc(1.5em + 0.75rem + 2px) !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: var(--text-main) !important;
    background-color: #fff !important;
    background-clip: padding-box !important;
    border: 1px solid #d1d3e2 !important;
    border-radius: 0.5rem !important;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out !important;
    box-shadow: none !important;
}

.form-select {
    display: block;
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.form-control:focus, .form-select:focus, .select2-container--bootstrap4.select2-container--focus .select2-selection {
    color: #6e707e !important;
    background-color: #fff !important;
    border-color: #bac8f3 !important;
    outline: 0 !important;
    box-shadow: 0 0 0 0.2rem rgba(78,115,223,.1) !important;
}

/* Force Select2 to be fully visible and 100% width */
.select2-container {
    display: block !important;
    width: 100% !important;
}

.select2-container--bootstrap4 .select2-selection--single {
    height: calc(1.5em + 0.75rem + 2px) !important;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    line-height: calc(1.5em + 0.75rem) !important;
    padding-left: 0.75rem !important;
    color: var(--text-main) !important;
}

.select2-dropdown {
    border: 1px solid #bac8f3 !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    overflow: hidden !important;
    z-index: 9999 !important;
}

.select2-results__option {
    padding: 8px 12px !important;
    font-size: 0.875rem !important;
}

.select2-container--bootstrap4 .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary) !important;
}

/* DataTables Alignment Overrides for AdminLTE 3 */
.dataTables_wrapper .row {
    margin-bottom: 0.5rem;
}

.dataTables_length label, .dataTables_filter label {
    font-weight: 600 !important;
    color: var(--text-muted);
}

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

/* Elevation Fixes */
.elevation-4 {
    box-shadow: 0 14px 28px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.22)!important;
}

/* Premium Info Boxes (AdminLTE structure compatibility) */
.info-box.premium-info-box {
    border-radius: 1rem !important;
    border: none !important;
    color: white !important;
    transition: transform 0.3s ease;
}

.info-box.premium-info-box:hover {
    transform: translateY(-3px);
}

.info-box.premium-info-box .info-box-icon {
    border-radius: 1rem 0 0 1rem !important;
    background: rgba(0,0,0,0.1) !important;
    font-size: 1.8rem !important;
}

.info-box.premium-info-box .info-box-text {
    font-weight: 500 !important;
    text-transform: uppercase;
    font-size: 0.75rem !important;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.info-box.premium-info-box .info-box-number {
    font-weight: 800 !important;
    font-size: 1.5rem !important;
    letter-spacing: -0.5px;
}

/* Gradients */
.bg-premium-success { background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%) !important; }
.bg-premium-danger { background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important; }
.bg-premium-info { background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%) !important; }
.bg-premium-primary { background: linear-gradient(135deg, #007bff 0%, #0069d9 100%) !important; }
.bg-premium-purple { background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%) !important; }
.bg-premium-warning { background: linear-gradient(135deg, #ffc107 0%, #edb100 100%) !important; color: #333 !important; }

/* Organization Chart Styles (AdminLTE compatible) */
.org-chart-container {
    padding: 20px;
    background: #fff;
    border-radius: 0.75rem;
    overflow-x: auto;
}

/* Spacing Utilities (BS5 compatibility for BS4) */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.d-flex.gap-1, .d-flex.gap-2, .d-flex.gap-3 { display: flex !important; }
/* Sidebar Active Sub-menu Fix */
.sidebar-dark-primary .nav-treeview > .nav-item > .nav-link.active { background-color: rgba(255,255,255,0.15) !important; color: #ffffff !important; }
.sidebar-dark-primary .nav-treeview > .nav-item > .nav-link.active:hover { background-color: rgba(255,255,255,0.25) !important; }

/* Dashboard Specific Styles 2.0 - Premium SaaS Refinement */
.hero-banner {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white !important;
    padding: 3rem;
    border-radius: 2rem;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 60%);
    pointer-events: none;
}

.welcome-text h1 {
    font-size: 2.75rem !important;
    font-weight: 800 !important;
    margin-bottom: 0;
    letter-spacing: -2px;
    color: white !important;
    text-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.date-badge {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.75rem 1.5rem !important;
    border-radius: 100px !important;
}

.glass-card {
    background: white;
    border-radius: 1.5rem;
    padding: 1.75rem;
    height: 100%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.glass-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
    border-color: #e2e8f0;
}

.stat-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.75rem;
    display: block;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -1px;
    margin-bottom: 0.25rem;
}

.action-card {
    background: #ffffff;
    border-radius: 1.5rem;
    padding: 2rem;
    text-align: center;
    text-decoration: none !important;
    color: #475569 !important;
    border: 1px solid #f1f5f9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.action-card:hover {
    background: #f8fafc;
    border-color: var(--primary);
    transform: translateY(-5px);
    color: var(--primary) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
}

.action-card i {
    font-size: 2.5rem;
    display: block;
    opacity: 0.9;
}

.pulse {
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse 2s infinite;
}

.card.company-pulse-card {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 1.5rem !important;
}

/* Page Hero Components */
.page-hero {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white !important;
    padding: 2rem;
    border-radius: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.page-hero h2 {
    font-weight: 800;
    margin-bottom: 0.25rem;
    letter-spacing: -1px;
}

.table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    border-top: none !important;
    padding: 1.25rem 1rem !important;
}

.table tbody td {
    padding: 1rem !important;
    vertical-align: middle !important;
    color: #1e293b;
    font-weight: 500;
    border-top: 1px solid #f1f5f9 !important;
}

.form-control-premium {
    border-radius: 0.75rem !important;
    padding: 0.75rem 1.25rem !important;
    border: 1px solid #e2e8f0 !important;
    height: auto !important;
    transition: all 0.2s;
}

.form-control-premium:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(0, 82, 204, 0.1) !important;
}
