/* =========================================
   EW-NET Brand Theme Variables
   ========================================= */
:root,
[data-bs-theme="light"] {
    --sidebar-bg: #ffffff;
    --sidebar-text: #495057;
    --sidebar-hover-bg: #f8f9fa;
    --sidebar-active-bg: #1a5fb4;
    --sidebar-active-text: #ffffff;
    --sidebar-border: #e9ecef;
    --topbar-bg: #ffffff;
    --topbar-border: #e9ecef;
    --card-shadow: 0 2px 12px rgba(26, 95, 180, 0.08);
    --card-shadow-hover: 0 4px 20px rgba(26, 95, 180, 0.12);
    --primary-gradient: linear-gradient(135deg, #1a5fb4 0%, #3584e4 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --brand-red: #e01b24;
    --brand-blue: #1a5fb4;
}

[data-bs-theme="dark"] {
    --sidebar-bg: #1a1d21;
    --sidebar-text: #adb5bd;
    --sidebar-hover-bg: #2c3034;
    --sidebar-active-bg: #1a5fb4;
    --sidebar-active-text: #ffffff;
    --sidebar-border: #2c3034;
    --topbar-bg: #1a1d21;
    --topbar-border: #2c3034;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
    --primary-gradient: linear-gradient(135deg, #1a5fb4 0%, #3584e4 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --brand-red: #e01b24;
    --brand-blue: #1a5fb4;
}

/* =========================================
   Global Styles
   ========================================= */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* =========================================
   Topbar Styles
   ========================================= */
.topbar {
    background-color: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    height: 64px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

[data-bs-theme="dark"] .topbar {
    background-color: rgba(26, 29, 33, 0.95);
}

.topbar .navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

/* =========================================
   Sidebar Styles
   ========================================= */
.sidebar {
    min-height: calc(100vh - 64px);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
    transition: all 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    margin: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.sidebar .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--brand-blue);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.sidebar .nav-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--bs-body-color);
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(26, 95, 180, 0.3);
}

.sidebar .nav-link.active::before {
    transform: scaleY(1);
}

.sidebar .nav-link i {
    margin-right: 0.75rem;
    width: 1.25rem;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar h6 {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding: 0 1.25rem;
}

/* =========================================
   Card Enhancements
   ========================================= */
.card {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    border-bottom: 1px solid var(--bs-border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* =========================================
   Stat Cards (Dashboard)
   ========================================= */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: var(--primary-gradient);
    opacity: 0.05;
    border-radius: 50%;
    transform: translate(30%, -30%);
    transition: all 0.3s ease;
}

.stat-card:hover::before {
    transform: translate(20%, -20%) scale(1.2);
    opacity: 0.1;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(26, 95, 180, 0.3);
}

.stat-icon.success {
    background: var(--success-gradient);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.3);
}

.stat-icon.warning {
    background: var(--warning-gradient);
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.3);
}

.stat-icon.info {
    background: var(--info-gradient);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

/* =========================================
   Table Enhancements
   ========================================= */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--bs-tertiary-bg);
    border-bottom: 2px solid var(--bs-border-color);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bs-secondary-color);
    padding: 1rem;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--bs-tertiary-bg);
    transform: scale(1.001);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--bs-border-color);
}

/* =========================================
   Badge Enhancements
   ========================================= */
.badge {
    font-weight: 500;
    padding: 0.4em 0.75em;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    letter-spacing: 0.3px;
}

/* =========================================
   Button Enhancements
   ========================================= */
.btn {
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
}

.btn-primary:hover {
    background: var(--primary-gradient);
    filter: brightness(1.1);
}

.btn-success {
    background: var(--success-gradient);
    border: none;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
    border-width: 1.5px;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* =========================================
   Form Controls
   ========================================= */
.form-control,
.form-select {
    border-radius: 0.5rem;
    border: 1.5px solid var(--bs-border-color);
    padding: 0.625rem 0.875rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 0.2rem rgba(26, 95, 180, 0.15);
}

.input-group-text {
    border-radius: 0.5rem;
    border: 1.5px solid var(--bs-border-color);
    background-color: var(--bs-tertiary-bg);
}

/* =========================================
   Pagination
   ========================================= */
.pagination {
    margin-bottom: 0;
}

.page-link {
    border-radius: 0.5rem;
    margin: 0 0.125rem;
    padding: 0.5rem 0.875rem;
    font-weight: 500;
    border: 1.5px solid var(--bs-border-color);
    transition: all 0.2s ease;
}

.page-link:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-1px);
}

.page-item.active .page-link {
    background: var(--primary-gradient);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(26, 95, 180, 0.3);
}

/* =========================================
   Alerts
   ========================================= */
.alert {
    border-radius: 0.75rem;
    border: none;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* =========================================
   Progress Bars
   ========================================= */
.progress {
    border-radius: 0.5rem;
    height: 8px;
    overflow: hidden;
    background-color: var(--bs-tertiary-bg);
}

.progress-bar {
    background: var(--primary-gradient);
    transition: width 0.6s ease;
}

/* =========================================
   Animations
   ========================================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.4s ease;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        top: 64px;
        left: -100%;
        z-index: 1030;
        width: 100%;
        max-width: 280px;
        height: calc(100vh - 64px);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    }

    .sidebar.show {
        left: 0;
    }
}

@media (min-width: 768px) {
    .sidebar {
        width: 260px;
        flex-shrink: 0;
        position: sticky;
        top: 64px;
        height: calc(100vh - 64px);
        overflow-y: auto;
    }
}

/* =========================================
   Scrollbar Styling
   ========================================= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-secondary-bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}
