@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-soft);
    color: var(--text-dark);
    margin: 0;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .brand, .fw-bold {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
}

a { text-decoration: none; color: inherit; }

/* Layout Wrapper */
#app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

#sidebar .brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

#sidebar .nav-links {
    flex: 1;
    padding: 1.5rem 0.75rem;
    overflow-y: auto;
}

#sidebar .nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 0.25rem;
    transition: all 0.2s;
    font-weight: 500;
}

#sidebar .nav-item i {
    width: 24px;
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

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

#sidebar .nav-item.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

#sidebar .sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* Sidebar Collapsed State */
.sidebar-collapsed #sidebar {
    width: 80px;
}
.sidebar-collapsed #main-container {
    margin-left: 80px;
}
.sidebar-collapsed .pagination-fixed-bottom {
    left: 80px;
}
.sidebar-collapsed #sidebar .brand {
    padding: 0;
    justify-content: center;
}
.sidebar-collapsed #sidebar .brand h4,
.sidebar-collapsed #sidebar .brand small {
    display: none;
}
.sidebar-collapsed #sidebar .brand i {
    margin-right: 0 !important;
}
.sidebar-collapsed #sidebar .nav-item {
    justify-content: center;
    padding: 0.75rem 0;
}
.sidebar-collapsed #sidebar .nav-item i {
    margin-right: 0;
    font-size: 1.5rem;
}
.sidebar-collapsed #sidebar .nav-item span {
    display: none;
}
.sidebar-collapsed #sidebar .nav-group-label {
    display: none;
}
.sidebar-collapsed #sidebar .sidebar-footer .nav-item {
    justify-content: center;
    padding: 1rem 0;
}

/* Main Content Area */
#main-container {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#topbar {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
}
/* Toast Notifications */
#toast-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 50000; display: flex; flex-direction: column; gap: 0.75rem; pointer-events: none; }
.toast-item { 
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px); 
    padding: 1rem 1.25rem; border-radius: var(--radius-lg); 
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); 
    display: flex; align-items: center; justify-content: space-between; 
    min-width: 300px; max-width: 450px; pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-item.fade-out { opacity: 0; transform: translateX(20px); transition: 0.5s; }
.toast-content { display: flex; align-items: center; gap: 0.75rem; }
.toast-icon { font-size: 1.1rem; }
.toast-message { font-size: 0.85rem; font-weight: 600; color: var(--primary); }
.toast-close { background: transparent; border: none; font-size: 1.25rem; color: var(--text-muted); cursor: pointer; }

@keyframes toastIn { from { opacity: 0; transform: translateX(20px) scale(0.9); } to { opacity: 1; transform: translateX(0) scale(1); } }

/* Sticky Filter Bar */
.filter-bar-wrapper {
    position: sticky;
    top: var(--header-height);
    z-index: 950;
    transition: box-shadow 0.2s ease, border-radius 0.2s ease;
}
.filter-bar-wrapper.is-stuck {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    box-shadow: 0 8px 24px -4px rgba(0,0,0,0.15) !important;
    margin-bottom: 0 !important;
}
#filter-sentinel { height: 1px; pointer-events: none; }

#content-area {
    padding: 2rem;
    flex: 1;
}

/* Components */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.btn {
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-xl);
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
    filter: brightness(1.1);
}

.btn.bg-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border-color: var(--text-muted) !important;
}

/* View Toggle Button Styles */
.btn-group .btn {
    color: var(--text-muted);
    background: #fff;
    transition: all 0.2s ease;
}
.btn-group .btn:hover:not(.active) {
    color: var(--primary);
    background: var(--bg-soft);
}
.btn-group .btn.active {
    background-color: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15) !important;
    transform: none !important;
}

.form-control-osint {
    background: #fff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.8rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
}

/* Utility */
.mb-4 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }

/* Dashboard & Analytics */
.stats-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}
.stats-card::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background: var(--accent); opacity: 0.1;
}
.stats-card .icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.bg-primary-light { background: #eff6ff; color: #3b82f6; }
.bg-info-light { background: #f0f9ff; color: #0ea5e9; }
.bg-success-light { background: #ecfdf5; color: #10b981; }
.bg-warning-light { background: #fffbeb; color: #f59e0b; }
.bg-danger-light { background: #fef2f2; color: #ef4444; }

.stats-card .label { font-size: 0.7rem; text-transform: uppercase; font-weight: 700; color: var(--text-muted); margin-bottom: 0.2rem; letter-spacing: 0.02rem; }
.stats-card .value { font-size: 1.6rem; font-weight: 700; color: var(--primary); letter-spacing: -0.5px; }

/* Forms & Inputs - Intelligence Style */
.form-control-osint {
    background: #fff;
    border: 1.5px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
}
.form-control-osint:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    outline: none;
}

.search-input {
    position: relative;
    width: 100%;
}
.search-input i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}
.search-input .form-control {
    padding-left: 2.75rem !important;
}

/* Badges */
.badge-osint {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02rem;
}
.badge-osint-success { background: #ecfdf5; color: #059669; }
.badge-osint-danger { background: #fef2f2; color: #dc2626; }
.badge-osint-warning { background: #fffbeb; color: #d97706; }
.badge-osint-info { background: #eff6ff; color: #2563eb; }

/* Table System */
.osint-table-container {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.osint-table { width: 100%; border-collapse: collapse; }
.osint-table th { 
    background: #f8fafc; 
    padding: 1rem 1.25rem; 
    text-align: left; 
    font-size: 0.7rem; 
    font-weight: 700; 
    color: var(--text-muted); 
    text-transform: uppercase; 
    border-bottom: 1.5px solid var(--border-color);
}
.osint-table td { padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--border-color); font-size: 0.88rem; }
.osint-table tr:last-child td { border-bottom: none; }
.osint-table tr:hover td { background: var(--bg-soft); }

/* Skeleton Loading */
.skeleton { background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; border-radius: 4px; }
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skeleton-page { height: 400px; width: 100%; border-radius: var(--radius-lg); background: #fff; border: 1px solid var(--border-color); position: relative; overflow: hidden; }
.skeleton-page::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent); animation: skeleton-shimmer 1.5s infinite; }
@keyframes skeleton-shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* Scrollbar Custom */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; border: 2px solid var(--bg-soft); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.platform-item { 
    min-width: 100px; padding: 1rem; border-radius: 1rem; background: #fff; 
    border: 1px solid var(--border-color); text-align: center; transition: all 0.3s;
}
.platform-item i { font-size: 1.5rem; margin-bottom: 0.5rem; }
.platform-item .val { font-weight: 800; font-size: 1.1rem; color: var(--primary); }

.entity-tag { 
    padding: 0.4rem 0.8rem; border-radius: 0.75rem; background: #fff; 
    border: 1px solid var(--border-color); font-size: 0.8rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.5rem;
}
.entity-PERSON { border-left: 3px solid var(--primary); }
.entity-ORGANIZATION { border-left: 3px solid var(--accent); }
.entity-LOCATION { border-left: 3px solid #10b981; }

.table-modern {
    width: 100%; border-collapse: collapse;
}
.table-modern th {
    text-align: left; padding: 1rem; border-bottom: 1px solid var(--border-color);
    color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; font-weight: 700;
}
.table-modern td { padding: 1rem; border-bottom: 1px solid var(--border-color); }

/* Modals */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    z-index: 10000; display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 600px;
    padding: 2rem; box-shadow: var(--shadow-lg); animation: slideUp 0.3s ease-out;
}
.modal-content-premium {
    background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 1200px;
    padding: 0; box-shadow: var(--shadow-lg); animation: slideUp 0.3s ease-out; overflow: hidden;
}
.modal-content-premium .modal-header { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 1.5rem 2rem; background: #f8fafc; border-bottom: none; margin: 0; 
}
.modal-content-premium .modal-body { padding: 2rem; }
.modal-content-premium .modal-footer { 
    display: flex; justify-content: flex-end; gap: 1rem; 
    padding: 1.25rem 2rem; background: #f8fafc; border-top: none; margin: 0; 
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 1.5rem; }
.modal-close-btn {
    background: #fff; border: 1px solid var(--border-color); font-size: 1.1rem; line-height: 1;
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}
.modal-close-btn:hover { background: #fee2e2; color: #ef4444; border-color: #fca5a5; transform: rotate(90deg); }
.form-control, .form-select {
    width: 100%; padding: 0.75rem 1rem; border-radius: 0.75rem; border: 1px solid var(--border-color);
    font-family: inherit; transition: all 0.2s;
}
.form-control:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1); }

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

::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Utilities */
.hidden { display: none !important; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Pagination Fixed Bottom */
.pagination-fixed-bottom {
    position: fixed;
    bottom: 0;
    right: 0;
    left: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: 0 1.5rem;
    z-index: 100;
    box-shadow: 0 -4px 10px -2px rgba(0,0,0,0.03);
}
.pagination-fixed-bottom .pagination-container {
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    font-size: 0.8rem;
}
.pagination-fixed-bottom .btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}
.pagination-fixed-bottom .form-select-sm {
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
    font-size: 0.8rem;
}
.pagination-limit .form-select {
    padding-right: 2rem;
    min-width: 96px;
