:root {
    --primary: #4e73df;
    --secondary: #858796;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --light: #f8f9fc;
    --dark: #5a5c69;
    --sidebar-bg: #2c3e50;
    --sidebar-width: 14rem;
    --sidebar-collapsed-width: 6.5rem;
    --topbar-height: 4.375rem;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light);
    color: #5a5c69;
    overflow-x: hidden;
}

#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    background-image: linear-gradient(180deg, #2c3e50 10%, #22303e 100%);
    background-size: cover;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

.sidebar .sidebar-brand {
    height: var(--topbar-height);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 800;
    padding: 1.5rem 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    z-index: 1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar .nav-item {
    position: relative;
}

.sidebar .nav-item .nav-link {
    display: block;
    width: 100%;
    text-align: left;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.sidebar .nav-item .nav-link i {
    font-size: 0.85rem;
    margin-right: 0.25rem;
    width: 2rem;
    text-align: center;
}

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

.sidebar .nav-item .nav-link span {
    font-size: 0.85rem;
    display: inline;
}

.sidebar-divider {
    margin: 0 1rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* Sidebar Toggled State */
.sidebar.toggled {
    width: var(--sidebar-collapsed-width);
    overflow: visible;
}

.sidebar.toggled .nav-item .nav-link {
    text-align: center;
    padding: 0.75rem 1rem;
}

.sidebar.toggled .nav-item .nav-link span {
    font-size: 0.65rem;
    display: block;
}

/* --- Content & Topbar --- */
#content-wrapper {
    background-color: var(--light);
    width: 100%;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.topbar {
    height: var(--topbar-height);
    background-color: #fff;
    box-shadow: 0 .15rem 1.75rem 0 rgba(58, 59, 69, .15);
    z-index: 10;
}

.card {
    border: none;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 1.5rem;
}

/* --- DataTables Customization --- */
.table {
    color: #5a5c69;
}

table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0;
    border: 1px solid #e3e6f0;
    border-radius: 0.35rem;
    overflow: hidden;
    width: 100% !important;
}

/* Force DataTables Header to match Sidebar Theme */
table.dataTable thead th,
table.dataTable thead td,
.table-dark thead th,
.table-dark thead td,
.table-dark th {
    background-color: var(--sidebar-bg) !important;
    background-image: linear-gradient(180deg, #2c3e50 10%, #22303e 100%) !important;
    color: #fff !important;
    font-weight: 700;
    border-bottom: 1px solid #4e5d6c;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-top: none !important;
}

/* Force DataTables Footer to match Sidebar Theme */
table.dataTable tfoot th,
table.dataTable tfoot td,
.table-dark tfoot th,
.table-dark tfoot td {
    background-color: var(--sidebar-bg) !important;
    background-image: linear-gradient(180deg, #2c3e50 10%, #22303e 100%) !important;
    color: #fff !important;
    font-weight: 700;
    font-size: 0.85rem;
    border-top: 1px solid #4e5d6c;
    text-transform: uppercase;
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

/* Override Bootstrap .table-dark background */
.table-dark {
    background-color: var(--sidebar-bg) !important;
    color: #fff;
}

table.dataTable tbody td {
    vertical-align: middle;
    padding: 0.75rem;
    border-color: #e3e6f0 !important;
}

table.dataTable tbody tr:hover {
    background-color: rgba(44, 62, 80, 0.05);
}

/* Pagination Active State */
.page-item.active .page-link {
    background-color: var(--sidebar-bg) !important;
    border-color: var(--sidebar-bg) !important;
    color: #fff !important;
}

.page-item .page-link:hover {
    background-color: #22303e !important;
    border-color: #22303e !important;
    color: #fff !important;
}

.page-link {
    color: var(--sidebar-bg);
}

/* --- Action Icons Styling --- */
.btn-ellipsis-edit, 
.btn-ellipsis-delete,
.btn-archive,
.btn-unarchive {
    border: none !important;
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    transition: all 0.2s ease;
    margin: 0 0.15rem;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0 !important;
}

/* Edit - Info/Blue */
.btn-ellipsis-edit {
    color: var(--info) !important;
    background-color: rgba(54, 185, 204, 0.1) !important;
}
.btn-ellipsis-edit:hover {
    background-color: var(--info) !important;
    color: #fff !important;
    transform: scale(1.1);
}

/* Delete - Danger/Red */
.btn-ellipsis-delete {
    color: var(--danger) !important;
    background-color: rgba(231, 74, 59, 0.1) !important;
}
.btn-ellipsis-delete:hover {
    background-color: var(--danger) !important;
    color: #fff !important;
    transform: scale(1.1);
}

/* Archive - Secondary/Gray */
.btn-archive {
    color: var(--secondary) !important;
    background-color: rgba(133, 135, 150, 0.1) !important;
}
.btn-archive:hover {
    background-color: var(--secondary) !important;
    color: #fff !important;
    transform: scale(1.1);
}

/* Unarchive - Success/Green */
.btn-unarchive {
    color: var(--success) !important;
    background-color: rgba(28, 200, 138, 0.1) !important;
}
.btn-unarchive:hover {
    background-color: var(--success) !important;
    color: #fff !important;
    transform: scale(1.1);
}

/* --- Modal Close Button Styling --- */
.modal-header .close {
    padding: 1rem 1rem;
    margin: -1rem -1rem -1rem auto;
    color: #aaa;
    text-shadow: none;
    opacity: 1;
    transition: color 0.2s ease;
    font-size: 1.5rem;
    font-weight: 300;
    background: transparent;
    border: 0;
}

.modal-header .close:hover {
    color: var(--danger);
    text-decoration: none;
}

.modal-header .close:focus {
    outline: none;
}

/* Optional: Make it a circle like other action buttons */
.modal-header .close.btn-circle {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.05);
    margin-left: auto;
    padding: 0;
}

.modal-header .close.btn-circle:hover {
    background-color: rgba(231, 74, 59, 0.1);
    color: var(--danger);
}

/* --- Primary Button Override --- */
.btn-primary {
    background-color: var(--sidebar-bg) !important;
    border-color: var(--sidebar-bg) !important;
    color: #fff !important;
}

.btn-primary:hover {
    background-color: #22303e !important;
    border-color: #22303e !important;
}

.btn-primary:active, .btn-primary:focus, .btn-primary:active:focus {
    background-color: #22303e !important;
    border-color: #22303e !important;
}

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