/* Apna Bank - Main Styles */

:root {
    --primary-color: #D2042D;
    --primary-dark: #a00322;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 0.5rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --sidebar-width: 280px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

/* Main Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: all 0.3s ease;
    width: calc(100% - var(--sidebar-width));
    position: relative;
}

@media (max-width: 991.98px) {
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
}

.main-content {
    max-width: 100%;
}

.container-fluid,
.container {
    overflow-x: visible;
    overflow-y: visible;
    max-width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
}

.container-fluid > .row {
    overflow: visible;
    margin-right: 0;
    margin-left: 0;
}

.content-wrapper {
    padding: 1rem;
    width: 100%;
}

@media (max-width: 767.98px) {
    .content-wrapper {
        padding: 0.75rem;
    }
}

/* Fix responsive layout */
@media (max-width: 991.98px) {
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .stat-card .card-body {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

@media (max-width: 575.98px) {
    .stat-card h4 {
        font-size: 1.1rem;
    }
    
    .stat-card h6 {
        font-size: 0.75rem;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
}

/* Ensure stat cards use full width properly */
.stat-card {
    min-width: 0;
}

.stat-card .card-body {
    min-width: 0;
}

img {
    max-width: 100%;
    height: auto;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
    padding: 0.75rem 1rem;
}

.navbar .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
}

.navbar .nav-link:hover {
    color: white !important;
}

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

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--dark-color) 0%, #1a1d20 100%);
    z-index: 1040;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .nav {
    padding: 1rem 0;
}

.sidebar .nav-item {
    margin: 0.25rem 1rem;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

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

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Mobile Sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

.sidebar-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

/* Stats Cards */
.stat-card {
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Customer Avatar */
.customer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.customer-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

/* Table Styles */
.table th {
    font-weight: 600;
    border-top: none;
}

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

/* Card Styles */
.card {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* Button Styles */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

/* Form Styles */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(210, 4, 45, 0.25);
}

.input-group-text {
    background-color: #f8f9fa;
}

/* Progress Bar */
.progress {
    border-radius: var(--border-radius);
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: var(--border-radius);
}

/* Badge Styles */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Alert Styles */
.alert {
    border: none;
    border-radius: var(--border-radius);
}

/* Content Wrapper */
.content-wrapper {
    padding: 1rem;
}

/* Loan Details */
.loan-details > div {
    padding: 0.5rem 0;
}

/* Dropdown Menu */
.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: var(--border-radius);
}

/* Calendar Grid Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-header {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    padding: 8px 0;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #212529;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
    min-height: 40px;
}

.calendar-day:hover {
    background-color: #e9ecef;
    color: #212529;
}

.calendar-day.selected {
    background-color: var(--primary-color);
    color: white;
}

.calendar-day.today {
    background-color: var(--primary-color);
    color: white;
}

.calendar-day.has-collection {
    background-color: #d1e7dd;
    border: 2px solid #198754;
}

.calendar-day.has-collection.selected,
.calendar-day.has-collection.today {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.calendar-day.partial-collection {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
}

.calendar-day.partial-collection.selected,
.calendar-day.partial-collection.today {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.calendar-day.partial-collection .collection-indicator.partial {
    color: #ffc107;
}

.calendar-day.partial-collection.selected .collection-indicator.partial,
.calendar-day.partial-collection.today .collection-indicator.partial {
    color: white;
}

/* Calendar Legend */
.calendar-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    padding: 0.25rem 0;
}

.legend-box {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.legend-box.full {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid #28a745;
    color: #155724;
}

.legend-box.partial {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 2px solid #ffc107;
    color: #856404;
}

.legend-box.today {
    background: linear-gradient(135deg, var(--primary-color) 0%, #b91c3c 100%);
    border: 2px solid var(--primary-color);
    color: white;
}

.legend-box.none {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #adb5bd;
}

.calendar-day.empty {
    pointer-events: none;
}

.day-number {
    line-height: 1;
}

.collection-indicator {
    font-size: 0.625rem;
    color: #198754;
    position: absolute;
    bottom: 2px;
}

.calendar-day.selected .collection-indicator,
.calendar-day.today .collection-indicator {
    color: white;
}

/* List Group */
.list-group-item {
    border-color: rgba(0, 0, 0, 0.05);
}

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

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

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .btn {
        display: none !important;
    }
    
    .main-wrapper {
        margin-left: 0;
    }
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    .stat-card .card-body {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
