/* style.css */

/* Custom font import for Inter - already present */
body {
    font-family: 'Inter', sans-serif;
}

/* Base styles for dark mode */
body {
    background-color: #1a202c; /* gray-900 */
    color: #e2e8f0; /* gray-200 - General text color */
    line-height: 1.6; /* Improved readability */
}

/* Section styling - Consistent look for content blocks */
section {
    background-color: #2d3748; /* gray-800 */
    border: 1px solid #4a5568; /* gray-700 */
    border-radius: 0.75rem; /* More rounded corners */
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.2), 0 3px 7px -3px rgba(0, 0, 0, 0.15); /* Deeper shadow */
    padding: 1.75rem; /* Slightly more padding */
}

/* Headings within sections */
h2 {
    color: #cbd5e0; /* gray-300 */
    font-size: 1.875rem; /* text-3xl */
    font-weight: 700; /* font-bold */
    margin-bottom: 1.5rem; /* More space below headings */
}

h3 {
    color: #cbd5e0; /* gray-300 */
    font-size: 1.5rem; /* text-2xl */
    font-weight: 600; /* font-semibold */
    margin-bottom: 1rem;
}

/* Input fields, textareas, and selects */
.input-field {
    appearance: none !important;
    display: block !important;
    width: 100% !important;
    padding: 0.75rem 1rem !important; /* Increased padding */
    border: 1px solid #4a5568 !important; /* border-gray-600 */
    border-radius: 0.5rem !important; /* rounded-lg */
    background-color: #242b38 !important; /* Slightly darker than card background for contrast */
    color: #e2e8f0 !important; /* Light text color for readability on dark background */
    font-size: 1rem !important; /* Base font size */
    line-height: 1.5 !important;
    outline: none !important;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* Focus styles for input-field */
.input-field:focus {
    border-color: #63b3ed !important; /* Brighter blue on focus */
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.5) !important; /* Focus ring */
}

/* Placeholder text color */
.input-field::placeholder {
    color: #a0aec0 !important; /* gray-400 for placeholder */
    opacity: 0.7 !important;
}
.input-field::-webkit-input-placeholder { color: #a0aec0 !important; }
.input-field::-moz-placeholder { color: #a0aec0 !important; }
.input-field:-ms-input-placeholder { color: #a0aec0 !important; }
.input-field:-moz-placeholder { color: #a0aec0 !important; }


/* Action buttons - Consistent styling for all interactive buttons */
.action-btn {
    @apply inline-flex items-center px-5 py-2.5 border border-transparent rounded-lg shadow-md text-base font-medium text-white
           transition duration-200 ease-in-out transform hover:scale-105 hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-900;
    cursor: pointer;
}

/* Specific button colors */
.bg-blue-600 { @apply bg-blue-600 hover:bg-blue-700 focus:ring-blue-500; }
.bg-green-600 { @apply bg-green-600 hover:bg-green-700 focus:ring-green-500; }
.bg-red-600 { @apply bg-red-600 hover:bg-red-700 focus:ring-red-500; }
.bg-purple-600 { @apply bg-purple-600 hover:bg-purple-700 focus:ring-purple-500; }
.bg-yellow-600 { @apply bg-yellow-600 hover:bg-yellow-700 focus:ring-yellow-500; }


/* Table styling - Enhanced readability and visual appeal */
.data-table {
    @apply min-w-full divide-y divide-gray-700 rounded-lg overflow-hidden shadow-sm;
    border-collapse: collapse;
    width: 100%;
    table-layout: auto;
    margin-top: 1.5rem; /* Space above table */
}

.data-table thead th {
    @apply px-5 py-3 bg-gray-700 text-left text-xs font-semibold text-gray-400 uppercase tracking-wider;
    border-bottom: 2px solid #63b3ed; /* Primary blue accent border */
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer; /* Indicate sortable headers */
}
.data-table thead th i {
    margin-left: 0.5rem;
    color: #a0aec0; /* Lighter icon color */
}

.data-table tbody td {
    @apply px-5 py-3 text-sm text-gray-200;
    border-bottom: 1px solid #4a5568; /* Subtle row dividers */
    font-size: 0.95rem;
    vertical-align: middle; /* Center content vertically */
    word-wrap: break-word;
}

/* Zebra striping for table rows */
.data-table tbody tr {
    background-color: #2d3748; /* gray-800 */
    transition: background-color 0.2s ease-in-out;
}

.data-table tbody tr:nth-child(even) {
    background-color: #242b38; /* Slightly darker for stripes */
}

.data-table tbody tr:hover {
    background-color: #4a5568; /* gray-700 on hover */
}

/* Conditional Row Highlighting for Loans/Payments */
.data-table tbody tr.status-overdue {
    background-color: rgba(239, 68, 68, 0.15); /* Red-500 with transparency */
}
.data-table tbody tr.status-completed,
.data-table tbody tr.status-paid {
    background-color: rgba(16, 185, 129, 0.15); /* Green-500 with transparency */
}
.data-table tbody tr.status-active,
.data-table tbody tr.status-pending {
    /* No specific background, rely on default table row color */
}

/* Status Badges - Visually distinct status indicators */
.status-badge {
    @apply px-2 py-0.5 rounded-full text-xs font-semibold;
    white-space: nowrap;
}
.status-badge.active { @apply bg-blue-500 text-white; }
.status-badge.completed, .status-badge.paid { @apply bg-green-500 text-white; }
.status-badge.overdue { @apply bg-red-500 text-white; }
.status-badge.pending { @apply bg-yellow-500 text-gray-900; } /* Darker text for yellow */


/* Modal Styles - Improved visual hierarchy */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8); /* More opaque backdrop */
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px); /* Subtle blur for modern feel */
}

.modal-content {
    background-color: #2d3748; /* gray-800 */
    padding: 2.5rem; /* Increased padding */
    border: 1px solid #4a5568; /* gray-700 */
    border-radius: 1rem; /* More rounded */
    width: 95%;
    max-width: 550px; /* Slightly wider default */
    position: relative;
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.4), 0 8px 16px -8px rgba(0, 0, 0, 0.3); /* Stronger shadow */
    animation: fadeInScale 0.3s ease-out forwards; /* Entry animation */
}

/* Animation for modal entry */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.close-button {
    color: #cbd5e0;
    font-size: 2.2rem; /* Larger close button */
    font-weight: bold;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.close-button:hover,
.close-button:focus {
    color: #a0aec0;
    transform: rotate(90deg); /* Spin effect on hover */
}

/* Notification/Message Box */
#messageBox {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    transform: translateY(0);
}

#messageBox.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px); /* Slide out effect */
}

/* Navigation Link styles */
.nav-link {
    @apply text-gray-300 hover:text-blue-400 font-medium text-lg flex items-center justify-center
           transition duration-200 ease-in-out transform hover:scale-105;
    padding: 0.5rem 1rem; /* Add padding for better touch targets */
    border-radius: 0.5rem; /* Rounded corners for nav links */
}
.nav-link i {
    @apply mr-2;
}

/* Active navigation link */
.nav-link.active {
    @apply text-blue-400 bg-gray-700; /* Highlight active link with background */
    box-shadow: inset 0 0 0 1px rgba(99, 179, 237, 0.5); /* Subtle inner border */
}

/* Dashboard Summary Cards */
.summary-card {
    @apply bg-gray-700 p-5 rounded-lg shadow-md flex flex-col items-center justify-center text-center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    background-color: #232b39;
    border-radius: 0.75rem;
    box-shadow: 0 6px 12px -2px rgba(0,0,0,0.18), 0 3px 7px -3px rgba(0,0,0,0.12);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
}
.summary-card:hover {
    background-color: #313a4d;
    transform: translateY(-8px) scale(1.04);
    box-shadow: 0 12px 24px -4px rgba(0,0,0,0.28), 0 6px 14px -6px rgba(0,0,0,0.18);
}
.summary-label {
    @apply text-gray-400 text-base sm:text-lg mb-2;
}
.summary-value {
    @apply text-4xl sm:text-5xl font-bold; /* Even larger values */
}


/* Dashboard Status Cards */
.status-card {
    @apply bg-gray-700 p-5 rounded-lg shadow-md flex flex-col items-center justify-center text-center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    background-color: #232b39;
    border-radius: 0.75rem;
    box-shadow: 0 6px 12px -2px rgba(0,0,0,0.18), 0 3px 7px -3px rgba(0,0,0,0.12);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
}
.status-card:hover {
    background-color: #313a4d;
    transform: translateY(-8px) scale(1.04);
    box-shadow: 0 12px 24px -4px rgba(0,0,0,0.28), 0 6px 14px -6px rgba(0,0,0,0.18);
}
.status-label {
    @apply text-gray-400 text-base sm:text-lg mb-2;
}
.status-value {
    @apply text-4xl sm:text-5xl font-bold;
}

/* Crucial for hiding modals */
.hidden {
    display: none !important;
}

/* Styles for Borrower Cards (borrowers.html) */
.borrower-card {
    @apply bg-gray-700 p-4 rounded-lg shadow-md flex flex-col sm:flex-row justify-between items-start sm:items-center;
    transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
    border: 1px solid #4a5568;
}

.borrower-card:hover {
    @apply bg-gray-600;
    transform: translateY(-3px); /* Subtle lift on hover */
}

.borrower-info {
    @apply flex-grow mb-3 sm:mb-0;
}

.borrower-name {
    @apply text-lg font-semibold text-gray-100;
}

.borrower-contact {
    @apply text-sm text-gray-400;
}

.borrower-actions {
    @apply flex flex-wrap justify-end gap-2;
}

.borrower-actions .action-btn {
    @apply px-3 py-1 text-sm rounded-md;
}

/* Responsive adjustments */
@media (max-width: 1023px) {
    main {
        grid-template-columns: 1fr; /* Stack sections on smaller screens */
    }

    section {
        margin-bottom: 2rem; /* Add space between stacked sections */
    }

    /* Adjustments for small screens for borrower cards */
    .borrower-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .borrower-actions {
        width: 100%;
        justify-content: flex-start;
        margin-top: 0.75rem;
    }

    /* Adjust modal content for smaller screens */
    .modal-content {
        padding: 1.5rem;
        max-width: 90%;
    }
}
