:root {
    --primary-color: #990000;
    /* Dark Red */
    --primary-dark: #660000;
    --black: #000000;
    --gray-dark: #333333;
    --gray-light: #f4f4f4;
    --white: #fff;
    --text-color: #333;
    --sidebar-width: 250px;
    --header-height: 60px;
    --border-radius: 5px;
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    background-color: #f9f9f9;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

/* Layout Wrapper */
.main-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--black);
    color: var(--white);
    position: fixed;
    height: 100%;
    left: 0;
    top: 0;
    transition: var(--transition-speed);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    background-color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #ccc;
    font-weight: 400;
    transition: var(--transition-speed);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: var(--gray-dark);
    color: var(--white);
    border-left: 4px solid var(--primary-color);
}

.sidebar-menu i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

/* Main Content Area */
.content-wrapper {
    flex: 1;
    margin-left: 250px;
    /* Match sidebar width */
    display: flex;
    flex-direction: column;
    transition: var(--transition-speed);
    width: 100%;
}

/* If no sidebar (e.g. login page), remove margin */
.content-wrapper.no-sidebar {
    margin-left: 0;
}

/* Header/Navbar */
.navbar {
    background-color: var(--black);
    color: var(--white);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    /* Override default container width for fluid layout */
    padding: 0;
}

.navbar .brand {
    color: var(--white);
    font-size: 1.2rem;
    font-weight: bold;
    display: none;
    /* Hidden on desktop if sidebar is used, shown on mobile */
}

.header-right {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.user-info {
    margin-right: 20px;
    font-size: 0.9rem;
}

.user-info span {
    font-weight: bold;
    color: var(--primary-color);
}

/* Generic Container for content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

.btn {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white);
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

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

/* Dashboard Widgets */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Footer */
.footer {
    background: var(--black);
    color: #999;
    text-align: center;
    padding: 15px;
    font-size: 0.9rem;
    margin-top: auto;
}

/* Forms */
.form-container {
    max-width: 500px;
    margin: 50px auto;
    background: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.invalid-feedback {
    display: block;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content-wrapper {
        margin-left: 0;
    }

    .navbar .brand {
        display: block;
    }
}

/* LOGIN PAGE STYLES */
body.login-body {
    background-color: #990000;
    overflow: hidden;
    /* For canvas animation */
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    color: var(--white);
}

#login-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.login-container {
    position: relative;
    z-index: 2;
    display: flex;
    width: 900px;
    max-width: 90%;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    height: 500px;
}

.login-ad-side {
    flex: 1;
    background-color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.login-ad-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

.login-ad-text {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.login-form-side {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--text-color);
}

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo img {
    max-width: 150px;
    height: auto;
}

.login-form-side h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
}

/* Responsive Login */
@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
        height: auto;
        width: 90%;
        margin: 20px;
        max-width: 400px;
        /* Keep it neat on tablets */
    }

    .login-ad-side {
        display: none;
        /* Hide image on mobile as requested */
    }

    .login-form-side {
        padding: 30px;
    }
}

/* =========================================
   CUSTOM UTILITIES & COMPONENTS
   ========================================= */

/* UTILITIES */
.text-right {
    text-align: right;
}

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

.align-middle {
    vertical-align: middle !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

/* DISPLAY UTILITIES */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

@media (min-width: 768px) {
    .d-md-none {
        display: none !important;
    }

    .d-md-block {
        display: block !important;
    }
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mb-5 {
    margin-bottom: 3rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.mt-5 {
    margin-top: 3rem !important;
}

.p-4 {
    padding: 1.5rem !important;
}

.p-5 {
    padding: 3rem !important;
}

/* TABLES */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #f8f9fa;
    color: #495057;
    border-color: #dee2e6;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05);
}

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

/* BADGES */
.badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    color: #fff;
}

.badge-success {
    background-color: #28a745;
}

.badge-danger {
    background-color: #dc3545;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-primary {
    background-color: #007bff;
}

/* BUTTONS SMALL */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
}

/* PAGINATION */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: 0.25rem;
}

.page-item:first-child .page-link {
    margin-left: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

.page-item:last-child .page-link {
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

.page-item.active .page-link {
    z-index: 1;
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    cursor: auto;
    background-color: #fff;
    border-color: #dee2e6;
}

.page-link {
    position: relative;
    display: block;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: var(--primary-color);
    background-color: #fff;
    border: 1px solid #dee2e6;
}

.page-link:hover {
    z-index: 2;
    color: var(--primary-dark);
    text-decoration: none;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

/* FULL GRID SYSTEM */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

[class^="col-"],
[class*=" col-"] {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

/* Mobile First (xs) */
.col-1 {
    flex: 0 0 8.333333%;
    max-width: 8.333333%;
}

.col-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
}

.col-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.col-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.col-5 {
    flex: 0 0 41.666667%;
    max-width: 41.666667%;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.col-7 {
    flex: 0 0 58.333333%;
    max-width: 58.333333%;
}

.col-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
}

.col-9 {
    flex: 0 0 75%;
    max-width: 75%;
}

.col-10 {
    flex: 0 0 83.333333%;
    max-width: 83.333333%;
}

.col-11 {
    flex: 0 0 91.666667%;
    max-width: 91.666667%;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .col-md-1 {
        flex: 0 0 8.333333%;
        max-width: 8.333333%;
    }

    .col-md-2 {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }

    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-md-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
    }

    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-md-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }

    .col-md-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }

    .col-md-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }

    .col-md-10 {
        flex: 0 0 83.333333%;
        max-width: 83.333333%;
    }

    .col-md-11 {
        flex: 0 0 91.666667%;
        max-width: 91.666667%;
    }

    .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .mx-auto {
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

.align-items-end {
    align-items: flex-end !important;
}

.justify-content-center {
    justify-content: center !important;
}

.d-flex {
    display: flex !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

/* ALERTS */
.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.alert-secondary {
    color: #383d41;
    background-color: #e2e3e5;
    border-color: #d6d8db;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}


/* UTILITIES EXTENSION */
.h-100 {
    height: 100% !important;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.bg-info {
    background-color: #17a2b8 !important;
}

.bg-warning {
    background-color: #ffc107 !important;
}

.bg-success {
    background-color: #28a745 !important;
}

.bg-primary {
    background-color: #007bff !important;
}

.bg-danger {
    background-color: #dc3545 !important;
}

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

/* TOAST NOTIFICATIONS */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast-notification {
    background-color: #fff;
    border-left: 5px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px;
    margin-top: 10px;
    border-radius: 4px;
    width: 320px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    animation: slideInLeft 0.3s ease-out;
    transition: all 0.3s ease;
    opacity: 0;
    /* Started hidden, JS will animate in */
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification.hide {
    opacity: 0;
    transform: translateX(100%);
}

.toast-icon {
    margin-right: 15px;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.toast-content {
    flex: 1;
}

.toast-message {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 5px;
    display: block;
}

.toast-link {
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: underline;
}

.toast-close {
    cursor: pointer;
    color: #999;
    font-size: 1.2rem;
    line-height: 1;
    margin-left: 10px;
}

.toast-close:hover {
    color: #333;
}

@keyframes slideInLeft {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.text-center {
    text-align: center !important;
}

.font-weight-bold {
    font-weight: 700 !important;
}


/* BACKGROUND UTILITIES */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--gray-dark) !important;
}

.bg-success {
    background-color: #28a745 !important;
}

.bg-info {
    background-color: #17a2b8 !important;
}

.bg-warning {
    background-color: #ffc107 !important;
}

.bg-light {
    background-color: #f8f9fa !important;
}

.bg-dark {
    background-color: #343a40 !important;
}