/* ==========================================================================
   Base Styles
   ========================================================================== */

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

:root {
    --tblr-font-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

body {
    font-family: var(--tblr-font-sans-serif);
    background-color: var(--light-color);
    font-feature-settings: "cv03", "cv04", "cv11";
    line-height: 1.6;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-wrapper {
    flex: 1;
    padding-top: 1rem;
}

/* ==========================================================================
   Header Styles
   ========================================================================== */

.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
    border-bottom: 1px solid rgba(255,255,255,.1);
    padding: 0.5rem 0;
    min-height: 60px;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0.25rem 0;
}

.navbar-brand .m {
    font-weight: 700;
    letter-spacing: -0.025em;
    font-size: 1.1rem;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
}

.avatar-sm {
    width: 20px;
    height: 20px;
}

.navbar-nav .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 0.375rem;
    margin: 0 0.125rem;
    transition: all 0.2s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
}

.navbar-nav .nav-link.active {
    background-color: rgba(255,255,255,0.15);
}

.navbar-nav .nav-link .nav-link-icon {
    font-size: 0.8rem;
}

.navbar-nav .nav-link .nav-link-title {
    font-weight: 500;
}

.dropdown-menu-arrow {
    position: relative;
}

.dropdown-menu-arrow::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 12px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-left: 1px solid rgba(0,0,0,.15);
    border-top: 1px solid rgba(0,0,0,.15);
    z-index: -1;
}

/* ==========================================================================
   Page Content Styles
   ========================================================================== */

.page-header {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,249,250,0.95) 100%);
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 0;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
}

.page-pretitle {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    letter-spacing: -0.025em;
}

.page-body {
    padding-bottom: 2rem;
}

.btn-list {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-list .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

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

/* ==========================================================================
   Card Styles
   ========================================================================== */

.card {
    border: none;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
}

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

.card-header {
    background: linear-gradient(to right, #f8f9fa, #ffffff);
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* ==========================================================================
   Statistics Cards
   ========================================================================== */

.row-deck {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.row-deck > .col,
.row-deck > [class*="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.row-cards {
    margin-bottom: 1.5rem;
}

.stats-card {
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stats-card .card-body {
    padding: 1.5rem;
    position: relative;
    z-index: 2;
}

.stats-card .h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-card .subheader {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.stats-card .d-flex {
    align-items: center;
}

/* Statistics Card Variants */

.stats-card-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stats-card-primary .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.stats-card-info {
    background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    color: white;
}

.stats-card-info .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.stats-card-warning {
    background: linear-gradient(135deg, #f77f00 0%, #d62828 100%);
    color: white;
}

.stats-card-warning .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.stats-card-success {
    background: linear-gradient(135deg, #06ffa5 0%, #00b4d8 100%);
    color: white;
}

.stats-card-success .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.stats-card-primary .h1,
.stats-card-info .h1,
.stats-card-warning .h1,
.stats-card-success .h1 {
    color: white;
}

/* Animated Background Elements */
.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
    z-index: 1;
}

.stats-card::after {
    content: '';
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    z-index: 1;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-30px, -30px) rotate(180deg); }
}

/* ==========================================================================
   Table Styles
   ========================================================================== */

.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    background-color: var(--light-color);
    color: var(--dark-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 1rem;
}

.table td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-vcenter td,
.table-vcenter th {
    vertical-align: middle;
}

.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin: 0 0.125rem;
    border-radius: 0.25rem;
}

.btn-group-sm > .btn, .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

.form-control {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-select {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    padding: 0.625rem 2.25rem 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* ==========================================================================
   Select2 Custom Styles
   ========================================================================== */

.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 2.25;
    color: #495057;
    padding-left: 0.875rem;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    color: #6c757d;
}

/* ==========================================================================
   Badge Styles
   ========================================================================== */

.badge {
    font-size: 0.75em;
    font-weight: 500;
    padding: 0.375em 0.75em;
    border-radius: 0.375rem;
    letter-spacing: 0.025em;
}

/* ==========================================================================
   Footer Styles
   ========================================================================== */

.footer {
    background-color: white;
    border-top: 1px solid #e9ecef;
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer .list-inline-item:not(:last-child) {
    margin-right: 1rem;
}

.footer .link-secondary {
    color: #6c757d;
    text-decoration: none;
}

.footer .link-secondary:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-white {
    color: white !important;
}

.text-muted {
    color: #6c757d !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-info {
    background-color: var(--info-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .page-wrapper {
        padding-top: 0.5rem;
    }

    .page-header {
        padding: 1rem 0;
    }

    .card-body {
        padding: 1rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .btn-action {
        font-size: 0.625rem;
        padding: 0.125rem 0.375rem;
    }
}

@media (max-width: 576px) {
    .page-title {
        font-size: 1.5rem;
    }

    .btn-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-list .btn {
        width: 100%;
    }
}

/* ==========================================================================
   Animation Styles
   ========================================================================== */

.btn {
    transition: all 0.2s ease-in-out;
}

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

.card {
    transition: box-shadow 0.2s ease-in-out;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   DataTables Custom Styles
   ========================================================================== */

.dt-container {
    margin-top: 1rem;
}

.dt-container .dt-paging .dt-paging-button {
    border-radius: var(--border-radius);
    margin: 0 0.125rem;
}

.dt-container .dt-paging .dt-paging-button.current {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.dt-container .dt-length select {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
}

.dt-container .dt-search input {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
}