:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4cc9f0;
    --success-color: #4ad66d;
    --warning-color: #f8961e;
    --danger-color: #f72585;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --light-gray: #e9ecef;
    --white: #ffffff;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --header-height: 70px;
    --transition: all 0.3s ease;
    --border-radius: 12px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7ff 0%, #e6e9ff 100%);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    padding-bottom: 60px;
    overflow-x: hidden;
}

/* Header Styles */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(67, 97, 238, 0.15);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    z-index: 1000;
    transition: var(--transition);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-container img {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo-container span {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    cursor: pointer;
    margin-right: 1rem;
}

.user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* Sidebar Styles */

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--box-shadow);
    z-index: 999;
    transition: var(--transition);
    overflow-y: auto;
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-content {
    padding: 1.5rem 1rem;
}

.sidebar-header {
    padding: 0 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
}

.sidebar-header h3 {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    border-radius: var(--border-radius);
    color: #5a6a8c;
    transition: var(--transition);
    text-decoration: none;
    margin-bottom: 0.25rem;
}

.nav-link i {
    font-size: 1.25rem;
    min-width: 24px;
    text-align: center;
    margin-right: 0.75rem;
    transition: var(--transition);
}

.nav-link span {
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(67, 97, 238, 0.08);
    color: var(--primary-color);
    transform: translateX(4px);
}

.nav-link:hover::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--primary-color);
    border-radius: 0 8px 8px 0;
}

.nav-link.active {
    background: rgba(67, 97, 238, 0.12);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary-color);
}

/* Main Content Styles */

.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 2rem;
    transition: var(--transition);
    min-height: calc(100vh - var(--header-height));
}

.page-title {
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 1rem;
}

.page-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.page-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.12), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.metric-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.05) 0%, transparent 100%);
    z-index: -1;
}

.metric-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.8);
}

.metric-card .card-body {
    padding: 1.75rem;
}

.metric-card .metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.metric-card .metric-title {
    font-size: 1.1rem;
    color: #5a6a8c;
    font-weight: 500;
}

/* Table Styles */

.data-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.data-section h3 {
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
}

.data-section h3::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
}

.table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.table thead th {
    border: none;
    padding: 1.1rem 1.25rem;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: background 0.3s ease;
}

.table tbody tr:nth-child(even) {
    background-color: rgba(245, 247, 255, 0.6);
}

.table tbody tr:hover {
    background-color: rgba(67, 97, 238, 0.08) !important;
}

.table tbody td {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.03);
    color: #4a5568;
    font-weight: 500;
}

/* Footer Styles */

footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 1rem;
    background-color: var(--white);
    text-align: center;
    font-size: 0.8rem;
    color: var(--gray-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 10;
    transition: var(--transition);
}

/* PAGINATION STYLES */

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
    gap: 0.5rem;
}

.pagination-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid rgba(67, 97, 238, 0.2);
}

.pagination-link:hover {
    background: rgba(67, 97, 238, 0.2);
    transform: translateY(-2px);
}

.pagination-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0.5rem 0.75rem;
    color: var(--gray-color);
}

/* =============== FORM STYLES =============== */

.form-container:not(#nbs) {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    margin-top: 1.5rem;
    max-width: 700px;
    /*margin-left: auto;
    margin-right: auto;*/
}

.form-page-title {
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 1rem;
}

.form-page-title h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.form-page-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

/* Divider */

.dividerline {
    height: 2px;
    background: linear-gradient(90deg, rgba(67, 97, 238, 0.1) 0%, rgba(67, 97, 238, 0.4) 50%, rgba(67, 97, 238, 0.1) 100%);
    margin: 1.5rem 0;
    border-radius: 1px;
}

/* Form Styles */

.form-group {
    margin-bottom: 1.75rem;
}

.form-control-label {
    display: inline-block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.9rem 1.25rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    background-color: rgba(245, 247, 255, 0.4);
    transition: var(--transition);
    font-size: 1rem;
    color: var(--dark-color);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
    background-color: white;
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.invalid-feedback {
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: block;
}

/* Button Styles */

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    padding: 0.9rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.25);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(67, 97, 238, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.25);
}

/* Alert Styles */

.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: rgba(74, 214, 109, 0.15);
    border-color: var(--success-color);
    color: #155724;
}

.alert-danger {
    background-color: rgba(247, 37, 133, 0.15);
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background-color: rgba(248, 150, 30, 0.15);
    border-color: var(--warning-color);
    color: #856404;
}

/* Form Layout */

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.form-col {
    flex: 1;
    min-width: 250px;
}

/* Form Header */

.form-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.1) 0%, rgba(76, 201, 240, 0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--primary-color);
}

.form-header-text h4 {
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.form-header-text p {
    color: var(--gray-color);
    font-size: 0.95rem;
}

.form-text {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray-color);
}

/* =============== BILLING MANAGEMENT STYLES =============== */

.billing-container {
    max-width: 1200px;
    margin: 0 auto;
}

.client-selector {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.client-info h5 {
    font-size: 1.25rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.client-info p {
    color: var(--gray-color);
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.client-summary {
    display: flex;
    gap: 1.5rem;
}

.summary-item {
    text-align: center;
    padding: 1rem 1.5rem;
    background: rgba(245, 247, 255, 0.6);
    border-radius: var(--border-radius);
}

.summary-item span {
    display: block;
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.summary-item strong {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h5 {
    color: var(--secondary-color);
    font-weight: 600;
    margin: 0;
}

.badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.confirm-btn {
    background: rgba(74, 214, 109, 0.15);
    color: var(--success-color);
}

.confirm-btn:hover {
    background: rgba(74, 214, 109, 0.25);
    transform: translateY(-2px);
}

.invoice-btn {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.invoice-btn:hover {
    background: rgba(67, 97, 238, 0.2);
    transform: translateY(-2px);
}

/* Status indicators */

.status-completed {
    color: var(--success-color);
    background: rgba(74, 214, 109, 0.15);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    display: inline-block;
}

.status-pending {
    color: var(--warning-color);
    background: rgba(248, 150, 30, 0.15);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    display: inline-block;
}

.status-refunded {
    color: var(--danger-color);
    background: rgba(247, 37, 133, 0.15);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    display: inline-block;
}

/* Overdue indicators */

.overdue-low {
    color: #f8961e;
    font-weight: 500;
}

.overdue-medium {
    color: #f3722c;
    font-weight: 600;
}

.overdue-high {
    color: #f94144;
    font-weight: 700;
}

/* Empty state styles */

.no-data, .no-client-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: rgba(245, 247, 255, 0.4);
    border-radius: var(--border-radius);
    text-align: center;
}

.no-data i, .no-client-selected i {
    font-size: 3rem;
    color: rgba(67, 97, 238, 0.2);
    margin-bottom: 1rem;
}

.no-data p, .no-client-selected p {
    color: var(--gray-color);
    font-size: 1.1rem;
    margin: 0;
}

.no-invoice {
    color: var(--gray-color);
    font-style: italic;
}

/* Responsive adjustments */

@media (max-width: 992px) {
    .client-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    .client-summary {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .summary-item {
        padding: 0.75rem 1rem;
    }
    .summary-item strong {
        font-size: 1.25rem;
    }
    .btn-action {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Add to your existing CSS */

.billing-container .table td {
    vertical-align: middle;
}

.billing-container .form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    min-width: 130px;
}

.billing-container .btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Form styles for add_outstanding.html */

.billing-container form {
    max-width: 800px;
    /* margin: 0 auto;*/
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    height: calc(2.5em + .75rem + 2px);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -5px;
    margin-left: -5px;
}

.form-row>.form-group {
    padding-right: 5px;
    padding-left: 5px;
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 2rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #4e73df;
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #2e59d9;
}

.btn-outline-secondary {
    background-color: transparent;
    color: #6c757d;
    border: 1px solid #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #f8f9fa;
}

.button.thereugo {
    padding: .5rem 5rem;
    text-align: center;
    margin: 0 auto;
}

#buttonreset {
    text-align: center;
    margin: 0 auto;
}

#buttonreset #resetsofar {
    padding: .5rem 5rem;
}

/* Responsive Styles */

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .hamburger {
        display: block;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 1rem;
    }
    .main-content {
        padding: 1.5rem;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}