/* Login Page Background Styling */
.login-page {
    background-image: url('../../../login-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
}

.login-page .login-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    margin-top: 5%;
}

.login-page .card {
    background: transparent;
    border: none;
    box-shadow: none;
}

.login-page .card-body {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    margin: 10px;
    padding: 30px;
}

.login-page .login-logo {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    margin: 10px;
    padding: 20px;
    text-align: center;
}

.login-page .login-logo h4 {
    color: #333;
    font-weight: bold;
    margin: 0;
}

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

/* Ensure form elements are visible */
.login-page .form-control {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 5px;
}

.login-page .form-control:focus {
    background: rgba(255, 255, 255, 1);
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.login-page .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 5px;
    font-weight: bold;
    padding: 12px;
}

.login-page .btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Mobile responsiveness for login */
@media (max-width: 768px) {
    .login-page .login-box {
        margin: 10px;
        margin-top: 10%;
    }
    
    .login-page .login-logo {
        margin: 5px;
        padding: 15px;
    }
    
    .login-page .card-body {
        margin: 5px;
        padding: 20px;
    }
}

table.pretty {
    width: 100%;
}

table.pretty th, table.pretty td {
    border: 1px solid gainsboro;
    padding: 0.2em;
}

table.pretty caption {
    font-style: italic;
    font-weight: bold;
    margin-left: inherit;
    margin-right: inherit;
}

table.pretty thead tr th {
    border-bottom: 2px solid;
    font-weight: bold;
    text-align: center;
}

table.pretty thead tr th.empty {
    border: 0 none;
}

table.pretty tfoot tr th {
    border-bottom: 2px solid;
    border-top: 2px solid;
    font-weight: bold;
    text-align: center;
}

table.pretty tbody tr th {
    text-align: center;
}

table.pretty tbody tr td {
    border-top: 1px solid;
    text-align: center;
}

table.pretty tbody tr.odd td {
    background: none repeat scroll 0 0 #EBF4FB;
}

table.pretty tbody tr.even td {
    background: none repeat scroll 0 0 #BCEEEE;
}

table.pretty thead tr th.highlightcol {
    border-color: #2E6E9E #2E6E9E gainsboro;
    border-style: solid;
    border-width: 2px 2px 1px;
}

table.pretty tfoot tr th.highlightcol {
    border-left: 2px solid #2E6E9E;
    border-right: 2px solid #2E6E9E;
}

table.pretty thead tr th.lefthighlightcol, table.pretty tbody tr td.lefthighlightcol, table.pretty tfoot tr th.lefthighlightcol {
    border-left: 2px solid #2E6E9E;
}

table.pretty thead tr th.righthighlightcol, table.pretty tbody tr td.righthighlightcol, table.pretty tfoot tr th.righthighlightcol {
    border-right: 2px solid #2E6E9E;
}

table.pretty thead tr th.lefthighlightcolheader, table.pretty tbody tr td.lefthighlightcolheader, table.pretty tfoot tr th.lefthighlightcolheader {
    border-left: 2px solid #2E6E9E;
}

table.pretty thead tr th.righthighlightcolheader, table.pretty tbody tr td.righthighlightcolheader, table.pretty tfoot tr th.righthighlightcolheader {
    border-right: 2px solid #2E6E9E;
}

.strikethrough {
    text-decoration: line-through;
    color: red;
}

.month, .year {
    margin: 2px;
}

caption, th {
    text-align: left;
}


.font-11{
    font-size: 11px;
}

.style-0 {
    empty-cells: show;
    table-layout: fixed;
    width: 1315pt
}

.style-1 {
    color: white;
    padding-left: 10pt;
    font-size: 14pt;
    font-family: "Arial";
    font-weight: bold;
    font-style: normal;
    text-decoration: none;
    text-align: left;
    word-spacing: 0pt;
    letter-spacing: 0pt;
    background-color: #339933
}


.opacity-75 {
    opacity: 0.75;
    filter: alpha(opacity=75);
}
.opacity-50 {
    opacity: 0.5;
    filter: alpha(opacity=50);
}
.opacity-25 {
    opacity: 0.25;
    filter: alpha(opacity=25);
}
.opacity-0 {
    opacity: 0;
    filter: alpha(opacity=0);
}
.no-edge-top {
    top: 0;
}
.no-edge-bottom {
    bottom: 0;
}
.no-edge-left {
    left: 0;
}
.no-edge-right {
    right: 0;
}
.user_name{
    font-size:14px;
    font-weight: bold;
}
.comments-list .media{
    border-bottom: 1px dotted #ccc;
}

/* ===== DASHBOARD CONTAINER FIXES ===== */

/* Remove overflow containers - make widgets scroll with page */
.grid-stack-item-content {
    overflow: visible !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
}

.grid-stack {
    min-height: auto !important;
    overflow: visible !important;
}

/* Fix widget cards to not be contained */
.grid-stack-item {
    overflow: visible !important;
}

.grid-stack-item .card,
.grid-stack-item .small-box,
.grid-stack-item .info-box {
    overflow: visible !important;
}

.grid-stack-item .card-body,
.grid-stack-item .card-content {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

/* Fix chart containers */
.grid-stack-item .chart-container,
.grid-stack-item canvas {
    overflow: visible !important;
    height: auto !important;
}

/* Force proper widget positioning and prevent overlap */
.grid-stack {
    display: flex !important;
    flex-direction: column !important;
    gap: 30px !important;
}

.grid-stack-item {
    position: relative !important;
    width: 100% !important;
    left: 0 !important;
    margin-bottom: 30px !important;
    flex-shrink: 0 !important;
}

/* Specific positioning for each widget to prevent overlap */
.grid-stack-item[gs-id="LoanStatistics"] {
    order: 1 !important;
    margin-bottom: 30px !important;
}

.grid-stack-item[gs-id="LoanCollectionOverview"] {
    order: 2 !important;
    margin-bottom: 30px !important;
}

.grid-stack-item[gs-id="LoanStatusOverview"] {
    order: 3 !important;
    margin-bottom: 30px !important;
}

/* Ensure widgets have proper z-index stacking */
.grid-stack-item:nth-child(1) { z-index: 1; }
.grid-stack-item:nth-child(2) { z-index: 2; }
.grid-stack-item:nth-child(3) { z-index: 3; }

/* ===== RESPONSIVE ADMIN DASHBOARD FIXES ===== */

/* Mobile and Tablet Responsive Fixes */
@media (max-width: 768px) {
    /* Force mobile layout with proper spacing */
    .grid-stack {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        padding: 10px !important;
    }
    
    /* Fix grid stack items on mobile */
    .grid-stack-item {
        position: relative !important;
        width: 100% !important;
        left: 0 !important;
        margin-bottom: 20px !important;
        flex-shrink: 0 !important;
        order: unset !important;
    }
    
    /* Reset widget ordering for mobile - let them stack naturally */
    .grid-stack-item[gs-id="LoanStatistics"],
    .grid-stack-item[gs-id="LoanCollectionOverview"],
    .grid-stack-item[gs-id="LoanStatusOverview"] {
        order: unset !important;
        margin-bottom: 20px !important;
        width: 100% !important;
        position: relative !important;
        left: 0 !important;
        top: auto !important;
    }
    
    .grid-stack-item-content {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        margin-bottom: 20px !important;
    }
    
    /* Fix small-box cards for mobile */
    .small-box {
        margin-bottom: 15px;
        min-height: 120px;
    }
    
    .small-box .inner {
        padding: 10px 15px;
    }
    
    .small-box .inner h3 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    .small-box .inner p {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    
    .small-box .icon {
        font-size: 2rem;
        top: 10px;
        right: 10px;
    }
    
    /* Fix dashboard content wrapper */
    .content-wrapper {
        padding-left: 0;
        margin-left: 0;
    }
    
    /* Fix sidebar on mobile - work with AdminLTE's existing system */
    .main-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1050;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 250px;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    }
    
    /* Override AdminLTE's sidebar-collapse behavior on mobile */
    body.sidebar-open .main-sidebar {
        transform: translateX(0) !important;
        z-index: 1050;
    }
    
    /* Add overlay when sidebar is open */
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        pointer-events: auto;
    }
    
    /* Ensure sidebar content is visible */
    .main-sidebar .sidebar {
        height: 100%;
        overflow-y: auto;
        padding-top: 0; /* Remove extra padding that was cutting off logo */
    }
    
    /* Fix sidebar layout to prevent logo cutoff */
    .main-sidebar {
        display: flex;
        flex-direction: column;
        overflow: visible;
        width: 100%;
        max-width: 100%;
    }
    
    .main-sidebar .brand-link {
        flex-shrink: 0; /* Prevent logo area from shrinking */
        overflow: visible;
        position: relative;
    }
    
    .main-sidebar .sidebar {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    /* Ensure sidebar doesn't clip content */
    .main-sidebar * {
        box-sizing: border-box;
    }
    
    /* Mobile-specific logo container fixes */
    .main-sidebar .brand-link {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding-left: 15px;
        padding-right: 15px;
        width: 100%;
        min-width: 100%;
    }
    
    /* Ensure logo and text are properly spaced */
    .main-sidebar .brand-link .brand-image {
        flex-shrink: 0;
        margin-right: 15px;
    }
    
    .main-sidebar .brand-link .brand-text {
        flex: 1;
        min-width: 0;
    }
    
    .main-sidebar .sidebar-menu {
        padding: 0;
        margin: 0;
    }
    
    .main-sidebar .sidebar-menu li {
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .main-sidebar .sidebar-menu li a {
        color: #c2c7d0;
        padding: 15px 20px;
        display: block;
        text-decoration: none;
    }
    
    .main-sidebar .sidebar-menu li a:hover {
        background: rgba(255,255,255,0.1);
        color: white;
    }
    
    .main-sidebar .user-panel {
        background: rgba(0,0,0,0.2);
        padding: 15px;
        margin: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        color: white;
    }
    
    .main-sidebar .user-panel .info p {
        color: white;
        margin: 0;
        font-weight: 500;
    }
    
    .main-sidebar .user-panel .info a {
        color: #c2c7d0;
        font-size: 12px;
    }
    
    /* Fix sidebar brand/logo area */
    .main-sidebar .brand-link {
        background: rgba(0,0,0,0.3);
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 15px 20px;
        height: auto;
        min-height: 70px;
        display: flex;
        align-items: center;
        position: relative;
        z-index: 1;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin: 0;
        left: 0;
        right: 0;
    }
    
    .main-sidebar .brand-link .brand-image {
        width: 560px;
        height: auto;
        margin-right: 15px;
        flex-shrink: 0;
        border-radius: 50%;
    }
    
    .main-sidebar .brand-link .brand-text {
        color: white;
        font-weight: 600;
        font-size: 18px;
        line-height: 1.2;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Ensure brand link is fully visible */
    .main-sidebar .brand-link img,
    .main-sidebar .brand-link .brand-image {
        max-width: 560px;
        max-height: auto;
        width: auto;
        height: auto;
        display: block;
        object-fit: contain;
    }
    
    /* Fix any logo positioning issues */
    .main-sidebar .brand-link .brand-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    
    
    /* Fix search form in sidebar */
    .main-sidebar .sidebar-form {
        padding: 15px 20px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .main-sidebar .sidebar-form .form-control {
        background: rgba(255,255,255,0.1);
        border: 1px solid rgba(255,255,255,0.2);
        color: white;
    }
    
    .main-sidebar .sidebar-form .form-control::placeholder {
        color: rgba(255,255,255,0.7);
    }
    
    .main-sidebar .sidebar-form .btn {
        background: rgba(255,255,255,0.1);
        border: 1px solid rgba(255,255,255,0.2);
        color: white;
    }
    
    /* Fix navbar alignment on mobile */
    .main-header {
        position: relative;
        z-index: 1030;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .main-header .navbar {
        padding: 8px 15px;
        min-height: 56px;
    }
    
    .main-header .navbar-nav {
        align-items: center;
        flex-direction: row;
        margin: 0;
    }
    
    .main-header .navbar-nav .nav-item {
        display: flex;
        align-items: center;
        margin: 0 5px;
    }
    
    /* Fix user menu alignment on mobile */
    .main-header .user-menu .nav-link {
        display: flex;
        align-items: center;
        padding: 8px 12px;
        border-radius: 4px;
        transition: background-color 0.3s ease;
    }
    
    .main-header .user-menu .nav-link:hover {
        background-color: rgba(0,0,0,0.05);
    }
    
    .main-header .user-menu .user-image {
        width: 32px;
        height: 32px;
        margin-right: 8px;
        border: 2px solid rgba(0,0,0,0.1);
    }
    
    .main-header .user-menu .d-none.d-md-inline {
        font-size: 14px;
        font-weight: 500;
        color: #495057;
    }
    
    /* Fix notifications dropdown styling */
    .main-header .navbar-nav .dropdown-toggle {
        padding: 8px 12px;
        border-radius: 4px;
        transition: background-color 0.3s ease;
    }
    
    .main-header .navbar-nav .dropdown-toggle:hover {
        background-color: rgba(0,0,0,0.05);
    }
    
    .main-header .navbar-nav .dropdown-toggle .badge {
        position: absolute;
        top: 2px;
        right: 2px;
        font-size: 10px;
        padding: 2px 4px;
    }
    
    /* Fix content header */
    .content-header {
        padding: 10px 15px;
    }
    
    .content-header h1 {
        font-size: 1.5rem;
    }
    
    /* Fix breadcrumb */
    .breadcrumb {
        font-size: 0.8rem;
        padding: 5px 0;
    }
    
    /* Fix main content padding */
    .content {
        padding: 10px 15px;
    }
    
    /* Fix grid columns for mobile */
    .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 15px;
    }
    
    .col-lg-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }
    
    .col-lg-9 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }
    
    .col-lg-12 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }
}

/* Tablet specific fixes */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Fix grid stack items on tablet */
    .grid-stack-item {
        margin-bottom: 15px;
    }
    
    .grid-stack-item-content {
        height: auto !important;
        min-height: 200px;
        overflow: visible !important;
    }
    
    /* Fix small-box cards for tablet */
    .small-box {
        margin-bottom: 15px;
        min-height: 140px;
    }
    
    .small-box .inner {
        padding: 15px 20px;
    }
    
    .small-box .inner h3 {
        font-size: 1.8rem;
    }
    
    .small-box .inner p {
        font-size: 1rem;
    }
    
    .small-box .icon {
        font-size: 2.5rem;
    }
    
    /* Fix grid columns for tablet */
    .col-lg-3 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
        margin-bottom: 15px;
    }
}

/* Fix for very small screens */
@media (max-width: 480px) {
    .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .small-box .inner h3 {
        font-size: 1.2rem;
    }
    
    .small-box .inner p {
        font-size: 0.8rem;
    }
    
    .small-box .icon {
        font-size: 1.5rem;
    }
}

/* Fix for charts and graphs responsiveness */
@media (max-width: 768px) {
    .chart-container {
        height: 300px !important;
        width: 100% !important;
    }
    
    .chart {
        height: 300px !important;
        width: 100% !important;
    }
    
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Full-width widget charts and graphs */
.grid-stack-item-content .chart-container {
    width: 100% !important;
    height: 400px !important;
}

.grid-stack-item-content .chart {
    width: 100% !important;
    height: 400px !important;
}

.grid-stack-item-content canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* Responsive charts for 12-column widgets */
@media (max-width: 768px) {
    .grid-stack-item-content .chart-container {
        height: 300px !important;
    }
    
    .grid-stack-item-content .chart {
        height: 300px !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .grid-stack-item-content .chart-container {
        height: 350px !important;
    }
    
    .grid-stack-item-content .chart {
        height: 350px !important;
    }
}

/* Fix for DataTables on mobile */
@media (max-width: 768px) {
    .dataTables_wrapper {
        overflow-x: auto;
    }
    
    .table-responsive {
        border: none;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.3rem;
    }
}

/* Fix for modals on mobile */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 5px;
    }
    
    .modal-header {
        padding: 10px 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-footer {
        padding: 10px 15px;
    }
}

/* Fix for forms on mobile */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 8px 12px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 5px;
    }
}

/* Fix for navigation */
@media (max-width: 768px) {
    .navbar-nav {
        flex-direction: row;
        align-items: center;
    }
    
    .navbar-nav .nav-link {
        padding: 8px 12px;
        display: flex;
        align-items: center;
    }
    
    .navbar-toggler {
        border: none;
        padding: 4px 8px;
    }
    
    /* Fix hamburger menu button */
    [data-widget="pushmenu"] {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 8px 12px;
        color: #6c757d;
        font-size: 18px;
        border: none;
        background: none;
        cursor: pointer;
        transition: color 0.3s ease;
        z-index: 1060;
        position: relative;
    }
    
    [data-widget="pushmenu"]:hover {
        color: #495057;
    }
    
    [data-widget="pushmenu"]:focus {
        outline: none;
        color: #007bff;
    }
    
    /* Fix search form on mobile */
    .main-header .form-inline {
        display: none; /* Hide search on very small screens */
    }
    
    /* Fix notifications dropdown on mobile */
    .main-header .navbar-nav .dropdown {
        position: relative;
    }
    
    .main-header .navbar-nav .dropdown-menu {
        position: absolute !important;
        right: 0 !important;
        left: auto !important;
        top: 100% !important;
        min-width: 280px;
        max-width: 90vw;
        z-index: 1050;
        transform: none !important;
        margin-top: 0 !important;
    }
    
    /* Fix user dropdown on mobile */
    .main-header .user-menu .dropdown-menu {
        position: absolute !important;
        right: 0 !important;
        left: auto !important;
        top: 100% !important;
        min-width: 200px;
        max-width: 90vw;
        z-index: 1050;
        transform: none !important;
        margin-top: 0 !important;
    }
    
    /* Prevent layout shifts when dropdowns open */
    .main-header .navbar-nav .nav-item {
        position: relative;
        display: flex;
        align-items: center;
    }
    
    .main-header .navbar-nav .nav-link {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Fix for card layouts */
@media (max-width: 768px) {
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 10px 15px;
        font-size: 1rem;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .card-footer {
        padding: 10px 15px;
    }
}

/* Fix for button groups */
@media (max-width: 768px) {
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        margin-bottom: 5px;
        border-radius: 4px !important;
    }
    
    .btn-group .btn:first-child {
        border-top-left-radius: 4px !important;
        border-top-right-radius: 4px !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
    
    .btn-group .btn:last-child {
        border-top-left-radius: 0 !important;
        border-top-right-radius: 0 !important;
        border-bottom-left-radius: 4px !important;
        border-bottom-right-radius: 4px !important;
    }
}

/* Fix for pagination */
@media (max-width: 768px) {
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .page-link {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}

/* Fix for alerts */
@media (max-width: 768px) {
    .alert {
        padding: 10px 15px;
        margin-bottom: 15px;
        font-size: 0.9rem;
    }
}

/* Fix for badges */
@media (max-width: 768px) {
    .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* Fix for progress bars */
@media (max-width: 768px) {
    .progress {
        height: 20px;
        margin-bottom: 15px;
    }
    
    .progress-bar {
        font-size: 0.8rem;
        line-height: 20px;
    }
}

/* Fix for list groups */
@media (max-width: 768px) {
    .list-group-item {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

/* Fix for dropdowns - removed problematic static positioning */
@media (max-width: 768px) {
    .dropdown-item {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}