/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --dark: #1f2937;
    --darker: #111827;
    --light: #f9fafb;
    --gray: #6b7280;
    --gray-light: #e5e7eb;
    --gray-dark: #374151;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --border: #e5e7eb;
    --card-bg: #ffffff;
    --sidebar-bg: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== LAYOUT ===== */
.admin-container {
    display: flex;
    min-height: 100vh;
    background: var(--light);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: fixed;
    height: 100vh;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.logo-sub {
    font-size: 12px;
    opacity: 0.8;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-profile {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-avatar {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.profile-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-role {
    font-size: 12px;
    opacity: 0.8;
}

.profile-status {
    margin-left: auto;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success);
    position: relative;
}

.status-indicator::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: var(--success);
    opacity: 0.3;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 0.1; }
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.nav-item span {
    flex: 1;
}

.nav-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 20px;
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.system-status i {
    font-size: 18px;
    opacity: 0.8;
}

.status-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.status-text span:first-child {
    font-size: 12px;
    opacity: 0.8;
}

.status-value {
    font-size: 14px;
    font-weight: 600;
}

.status-value.active {
    color: var(--success);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 14px;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 24px;
    transition: var(--transition);
    min-height: 100vh;
}

.main-header {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
}

.header-left h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--darker);
    margin-bottom: 8px;
}

.header-subtitle {
    color: var(--gray);
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    color: var(--dark);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.btn-action.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.quick-search {
    position: relative;
}

.quick-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.quick-search input {
    padding: 12px 12px 12px 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    width: 200px;
    transition: var(--transition);
}

.quick-search input:focus {
    outline: none;
    border-color: var(--primary);
    width: 240px;
}

.header-notifications {
    display: flex;
    align-items: center;
    gap: 16px;
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray);
    cursor: pointer;
    padding: 8px;
    transition: var(--transition);
}

.notification-btn:hover {
    color: var(--primary);
}

.notification-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--error);
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.user-menu-btn:hover {
    transform: rotate(15deg);
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--border);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-icon.primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.stat-content {
    flex: 1;
}

.stat-content h3 {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--darker);
    margin-bottom: 8px;
}

.stat-trend {
    display: flex;
    gap: 16px;
    font-size: 12px;
}

.trend-up {
    color: var(--success);
    font-weight: 600;
}

.trend-down {
    color: var(--error);
    font-weight: 600;
}

/* ===== CHARTS SECTION ===== */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.chart-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chart-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--darker);
}

.chart-filter {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--dark);
    font-size: 14px;
    cursor: pointer;
}

.chart-body {
    padding: 24px;
    height: 300px;
}

/* ===== DATA SECTION ===== */
.data-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.data-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--darker);
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-link:hover {
    gap: 10px;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    width: 200px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    width: 240px;
}

.data-body {
    padding: 0;
}

.empty-state {
    padding: 60px 24px;
    text-align: center;
    color: var(--gray);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f9fafb;
}

th {
    padding: 16px 24px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: #f9fafb;
}

.company-info, .user-info, .location-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.company-info i, .user-info i {
    font-size: 24px;
    color: var(--gray);
}

.company-info div, .user-info div {
    display: flex;
    flex-direction: column;
}

.company-info small, .user-info small {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
}

.location-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.location-info small {
    font-size: 12px;
    color: var(--gray);
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    min-width: 80px;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.btn-icon {
    background: none;
    border: 1px solid var(--border);
    color: var(--gray);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.text-muted {
    color: var(--gray);
    font-size: 12px;
    display: block;
    margin-top: 4px;
}

/* ===== FOOTER ===== */
.main-footer {
    margin-top: 24px;
    padding: 24px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-info p {
    font-size: 14px;
    color: var(--gray-dark);
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--gray);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--darker);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: #f3f4f6;
    color: var(--error);
}

.modal-form {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-actions {
    margin-top: 24px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.form-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-check label {
    font-size: 14px;
    color: var(--dark);
}

.modal-alert {
    display: none;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.modal-alert.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.modal-alert.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
}

.btn-secondary, .btn-primary {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary {
    background: var(--light);
    color: var(--gray-dark);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--gray-light);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .charts-section,
    .data-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-right {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-action {
        width: 100%;
        justify-content: center;
    }
    
    .quick-search input {
        width: 100% !important;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 16px;
    }
    
    .modal-content {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        max-height: 100vh;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .btn-secondary, .btn-primary {
        width: 100%;
        justify-content: center;
    }
}