/* style.css */

:root {
    --primary-color: #0056b3; /* Professional Blue */
    --secondary-color: #28a745; /* Success Green */
    --text-color: #333;
    --light-gray: #f4f7f6;
    --border-color: #ddd;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--light-gray);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* --- MAIN HEADER & NAVIGATION STYLES --- */
.main-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px; /* Reduced padding slightly */
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-nav {
    max-width: 1200px; /* Increased max width */
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px; /* Adds space between elements */
}

.nav-logo {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap; /* Prevents logo from wrapping */
}

.nav-links-main {
    flex-grow: 1; /* Allows this section to take up available space */
    text-align: center; /* Centers the links nicely */
}

.nav-links-main a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 10px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.nav-links-main a:hover {
    color: var(--primary-color);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
    white-space: nowrap; /* Prevents user info from wrapping */
}

.nav-user a {
    background-color: #f8d7da;
    color: #721c24;
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: bold;
}
/* --- FORM STYLES --- */
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: #555; }
input[type="text"], input[type="tel"], input[type="email"], input[type="number"], textarea {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.name-group { display: flex; gap: 15px; }
.name-group .form-group { flex: 1; }
button[type="submit"] {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}
button[type="submit"]:hover { background-color: #004085; }
.message { padding: 15px; margin-bottom: 20px; border-radius: 5px; text-align: center; }
.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }


/* --- DASHBOARD STYLES --- */
.dashboard-container h1 {
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.card {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 20px;
}
.card-icon {
    font-size: 2.5em;
    padding: 15px;
    border-radius: 50%;
    background-color: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-info { display: flex; flex-direction: column; }
.card-title { font-size: 0.9em; color: #666; margin-bottom: 5px; }
.card-value { font-size: 1.5em; font-weight: bold; color: var(--primary-color); }
.quick-actions h2 {
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.action-buttons { display: flex; flex-wrap: wrap; gap: 15px; }
.action-btn {
    background-color: var(--primary-color);
    color: #fff;
    padding: 15px 25px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.action-btn:hover { background-color: #004085; transform: translateY(-2px); }
/* --- DATA TABLE STYLES --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table thead {
    background-color: var(--light-gray);
}

.data-table th, .data-table td {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.data-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.data-table tbody tr:hover {
    background-color: #f1f1f1;
}

.data-table .actions {
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 5px 10px;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    text-align: center;
}

.btn-view {
    background-color: var(--primary-color);
}

.btn-loan {
    background-color: var(--secondary-color);
}
/* --- CUSTOMER DETAILS PAGE STYLES --- */
.customer-details-card {
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 40px;
}

.customer-details-card h2 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.details-grid p {
    margin: 0;
    padding: 5px 0;
}
/* --- MANAGEMENT PAGE STYLES --- */
.management-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 20px;
}

.management-form {
    flex: 1;
    min-width: 300px;
    background-color: var(--light-gray);
    padding: 20px;
    border-radius: 8px;
    align-self: flex-start; /* Aligns form to the top */
}

.management-form h2 {
    margin-top: 0;
}

.management-list {
    flex: 2;
    min-width: 400px;
}

.btn-delete {
    background-color: #dc3545; /* Red for delete */
    border: none;
    cursor: pointer;
}
.btn-edit {
    background-color: #ffc107; /* Yellow for edit */
}
/* --- LOAN MANAGEMENT ACTION STYLES --- */
.management-actions {
    background-color: var(--light-gray);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.management-actions form {
    margin-right: 10px;
}
.btn-approve {
    background-color: var(--secondary-color); /* Green */
    border: none;
}
.btn-deny {
    background-color: #dc3545; /* Red */
    border: none;
}
.btn-complete {
    background-color: var(--primary-color); /* Blue */
    border: none;
}
/* --- LOAN MANAGEMENT ACTION STYLES --- */
.management-actions {
    background-color: var(--light-gray);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.management-actions h4 {
    margin-top: 0;
    margin-bottom: 15px;
}
.management-actions form {
    margin-right: 10px;
}
.btn-approve {
    background-color: var(--secondary-color); /* Green */
    border: none;
}
.btn-release {
    background-color: #17a2b8; /* Teal */
    border: none;
}
.btn-deny {
    background-color: #dc3545; /* Red */
    border: none;
}
.btn-complete {
    background-color: var(--primary-color); /* Blue */
    border: none;
}
/* --- SEARCH & PAGINATION STYLES --- */
.search-container {
    margin-bottom: 20px;
}
.search-container form {
    display: flex;
    max-width: 400px;
}
.search-container input[type="text"] {
    flex-grow: 1;
    border-right: 0;
    border-radius: 4px 0 0 4px;
}
.search-container button {
    padding: 10px 20px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
}

.pagination {
    margin-top: 20px;
    text-align: center;
}
.pagination a {
    color: var(--primary-color);
    padding: 8px 16px;
    text-decoration: none;
    border: 1px solid var(--border-color);
    margin: 0 4px;
    border-radius: 4px;
}
.pagination a.active {
    background-color: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}
.pagination a:hover:not(.active) {
    background-color: var(--light-gray);
}
/* ADD THIS TO YOUR STYLESHEET */
.search-form {
    display: flex;
    max-width: 400px;
}
.search-form input {
    flex-grow: 1;
    border-radius: 4px 0 0 4px;
    border-right: none;
}
.clear-btn {
    padding: 10px 20px;
    background-color: #6c757d; /* Gray */
    color: white;
    text-decoration: none;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
/* --- REPORTS PAGE & FILTER STYLES --- */
.filter-container {
    margin-bottom: 20px;
    background-color: var(--light-gray);
    padding: 20px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end; /* Aligns items to the bottom */
}
.filter-group {
    flex: 1; /* Allows the inputs to grow and fill space */
}
.filter-form label {
    display: block;
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 5px;
}
.filter-form input, .filter-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.filter-form button {
    padding: 10px 25px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    border-radius: 4px;
    height: 42px; /* Matches height of inputs */
}
/* --- NAVIGATION ICON STYLES --- */
.nav-links-main a i {
    margin-right: 8px; /* Adds space between icon and text */
    width: 20px; /* Ensures all icons have a consistent width */
    text-align: center;
}
/* --- USER STATUS STYLES --- */
.status-active, .status-inactive {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
}
.status-active {
    background-color: var(--secondary-color); /* Green */
}
.status-inactive {
    background-color: #6c757d; /* Gray */
}
.btn-deactivate {
    background-color: #ffc107; /* Yellow */
    border: none;
    cursor: pointer;
}
/* --- RECEIPT STYLES --- */
.receipt-container {
    max-width: 600px;
    margin: 20px auto;
    border: 1px solid #ccc;
    padding: 30px;
    font-family: 'Courier New', Courier, monospace;
    background: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
/* --- Find and replace these styles in your assets/style.css --- */

.receipt-header {
    display: flex; /* Use flexbox for alignment */
    justify-content: space-between; /* Pushes items to opposite ends */
    align-items: center; /* Vertically aligns items */
    border-bottom: 2px dashed #ccc;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.receipt-header img {
    max-height: 60px; /* Controls the logo size */
    max-width: 180px;
    /* The inline style for margin is no longer needed */
}

.receipt-header .company-details {
    text-align: right; /* Aligns company text to the right */
}

.receipt-header h1 {
    margin: 0;
    font-size: 24px;
}

.receipt-header p {
    margin: 0;
}

.receipt-title {
    text-align: center;
    margin: 10px 0 20px 0;
    font-size: 20px;
}
.receipt-header h2 {
    margin: 10px 0;
    font-size: 20px;
}
.receipt-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}
.receipt-body p {
    margin: 20px 0;
}
.receipt-table {
    width: 100%;
    border-collapse: collapse;
}
.receipt-table th, .receipt-table td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: left;
}
.receipt-table th {
    background-color: #f2f2f2;
}
.receipt-footer {
    text-align: center;
    margin-top: 30px;
    font-style: italic;
}

/* --- RECEIPT ACTIONS & BUTTON STYLES --- */
.receipt-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}
.back-btn {
    margin-left: auto; /* Pushes button to the far right */
    padding: 6px 12px !important;
    font-size: 0.9em !important;
    background-color: #6c757d !important;
    font-weight: normal !important;
}
.back-btn:hover {
    background-color: #5a6268 !important;
}
.whatsapp-btn {
    background-color: #25D366 !important;
}
.whatsapp-btn:hover {
    background-color: #128C7E !important;
}

/* --- PRINT-SPECIFIC STYLES --- */
@media print {
    body, .container, .main-content {
        background: #fff !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .main-header, .main-footer, .receipt-actions {
        display: none !important;
    }
    .receipt-container {
        border: none !important;
        box-shadow: none !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
}
