/* Modern Style CSS for 2024/2025 Design - Kumar Cables Service & Fibre Internet */

:root {
    /* Modern color palette */
    --primary-color: #4361ee;
    --primary-dark: #3a56d4;
    --secondary-color: #7209b7;
    --accent-color: #4cc9f0;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;

    /* Typography */
    --font-family-sans-serif: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-monospace: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

    /* Spacing */
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 1rem;
    --spacing-4: 1.5rem;
    --spacing-5: 3rem;

    /* Border radius */
    --border-radius-sm: 0.25rem;
    --border-radius: 0.5rem;
    --border-radius-lg: 1rem;
    --border-radius-xl: 1.5rem;
    --border-radius-pill: 50rem;

    /* Box shadow */
    --box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
    --box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.1);
}

/* Base styles */
body {
    font-family: var(--font-family-sans-serif);
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    overflow-x: hidden;
    padding-top: 70px; /* Add padding to account for fixed navbar */
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    box-shadow: var(--box-shadow);
    padding: 0.75rem 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: white !important;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.navbar-dark .navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.navbar-dark .navbar-nav .active > .nav-link {
    background-color: rgba(255, 255, 255, 0.2);
    color: white !important;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

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

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

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Stats cards */
.stats-card {
    text-align: center;
    padding: 1.5rem;
}

.stats-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.1);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 1rem;
}

.stats-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.stats-label {
    font-size: 1rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* Buttons */
.btn {
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

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

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

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

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

.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* Forms */
.form-control {
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table th {
    font-weight: 600;
    color: var(--gray-700);
    border-top: none;
    border-bottom: 2px solid var(--gray-300);
    padding: 1rem;
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid var(--gray-200);
}

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

.table-hover tbody tr:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

/* Responsive tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--gray-200);
    max-height: 500px;
    overflow-y: auto;
}

/* Custom scrollbar for tables */
.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

@media (max-width: 768px) {
    .table-responsive-card {
        display: block;
    }

    .table-responsive-card thead {
        display: none;
    }

    .table-responsive-card tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--gray-300);
        border-radius: var(--border-radius);
        box-shadow: var(--box-shadow-sm);
    }

    .table-responsive-card tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top: none;
        border-bottom: 1px solid var(--gray-200);
        padding: 0.75rem 1rem;
    }

    .table-responsive-card tbody td:last-child {
        border-bottom: none;
    }

    .table-responsive-card tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 1rem;
    }
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: var(--border-radius-pill);
}

.badge-primary {
    background-color: var(--primary-color);
}

.badge-success {
    background-color: var(--success-color);
}

.badge-warning {
    background-color: var(--warning-color);
    color: white;
}

.badge-danger {
    background-color: var(--danger-color);
}

/* Notifications */
.fa-bell {
    font-size: 1.2rem;
    position: relative;
    transition: color 0.3s ease;
}

.badge-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.7rem;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    padding: 0.25rem 0.5rem;
    min-width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#notificationList {
    min-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    border: none;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--gray-200);
}

/* Custom scrollbar for notifications */
#notificationList::-webkit-scrollbar {
    width: 8px;
}

#notificationList::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: 10px;
}

#notificationList::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    white-space: normal;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item.text-danger {
    color: var(--danger-color) !important;
}

.dropdown-item.text-warning {
    color: var(--warning-color) !important;
}

.dropdown-item.text-success {
    color: var(--success-color) !important;
}

.dropdown-divider {
    margin: 0;
    border-top: 1px solid var(--gray-300);
}

/* Notification items */
.notification-item {
    border-left: 3px solid var(--gray-300);
    padding: 1rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-sm);
    transition: transform 0.3s ease;
}

.notification-item:hover {
    transform: translateX(5px);
}

.notification-overdue {
    border-left-color: var(--danger-color);
}

.notification-pending {
    border-left-color: var(--warning-color);
}

.notification-upcoming {
    border-left-color: var(--success-color);
}

/* Notification scroll container */
.notification-scroll-container {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--gray-200);
}

.notification-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.notification-scroll-container::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: 10px;
}

.notification-scroll-container::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
}

/* Modals */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: var(--border-radius);
}

.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 var(--gray-300);
}

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

/* Loading spinner */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .btn {
        padding: 0.4rem 1rem;
        margin-bottom: 0.5rem;
        width: 100%;
    }

    /* Fix for button layout in mobile */
    .d-flex.flex-wrap.gap-2.mb-4 {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem !important;
    }

    .d-flex.flex-wrap.gap-2.mb-4 .btn {
        margin-bottom: 0;
        width: 100%;
    }

    /* Fix for export button */
    .d-flex.flex-wrap.gap-2.mb-4 .ms-auto {
        margin-left: 0 !important;
        grid-column: span 2;
    }

    .stats-card {
        padding: 1rem;
    }

    .stats-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .stats-value {
        font-size: 1.5rem;
    }

    .stats-label {
        font-size: 0.875rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .table {
        font-size: 0.875rem;
    }

    .form-control {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    /* Fix for customer details display */
    .table-responsive-card tbody td {
        text-align: right;
    }

    .table-responsive-card tbody td:before {
        float: left;
    }

    /* Fix for payments display */
    .payments-row .table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }

    .payments-row .table th,
    .payments-row .table td {
        white-space: nowrap;
    }

    .payments-table-container {
        max-height: 300px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--primary-color) var(--gray-200);
    }

    .payments-table-container::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    .payments-table-container::-webkit-scrollbar-track {
        background: var(--gray-200);
        border-radius: 10px;
    }

    .payments-table-container::-webkit-scrollbar-thumb {
        background-color: var(--primary-color);
        border-radius: 10px;
    }
}

/* Mobile navigation */
@media (max-width: 992px) {
    .navbar-collapse {
        background-color: var(--primary-color);
        border-radius: var(--border-radius);
        padding: 1rem;
        margin-top: 0.5rem;
        box-shadow: var(--box-shadow);
    }

    .navbar-nav .nav-item {
        margin-bottom: 0.5rem;
    }

    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
        border-radius: var(--border-radius);
    }

    .navbar-toggler {
        border: none;
        padding: 0.5rem;
    }

    .navbar-toggler:focus {
        outline: none;
        box-shadow: none;
    }

    .navbar-toggler-icon {
        width: 1.5em;
        height: 1.5em;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* WhatsApp and SMS buttons */
#sendWhatsAppBtn {
    background-color: #25D366;
    border-color: #25D366;
}

#sendSMSDirectBtn {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Utility classes */
.text-primary {
    color: var(--primary-color) !important;
}

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

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

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

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

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

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

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

.shadow-sm {
    box-shadow: var(--box-shadow-sm) !important;
}

.shadow {
    box-shadow: var(--box-shadow) !important;
}

.shadow-lg {
    box-shadow: var(--box-shadow-lg) !important;
}

.rounded {
    border-radius: var(--border-radius) !important;
}

.rounded-lg {
    border-radius: var(--border-radius-lg) !important;
}

.rounded-circle {
    border-radius: 50% !important;
}

/* Hover effects */
.hover-lift {
    transition: transform 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-shadow {
    transition: box-shadow 0.3s ease;
}

.hover-shadow:hover {
    box-shadow: var(--box-shadow-lg);
}
