/* Base Styles */
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

h1, h2, h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

h1 {
    text-align: center;
    margin: 20px 0;
}

/* Layout Containers */
#app-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Balance and IOU Summary */
.balance-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.balance, .iou-summary {
    font-size: 1.1em;
    padding: 10px 15px;
    border-radius: 5px;
    background: #f8f9fa;
}

.balance {
    color: #27ae60;
}

.iou-summary {
    color: #e67e22;
}

/* Forms */
.transaction-form {
    margin-bottom: 30px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: #3498db;
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.submit-btn {
    background-color: #2ecc71;
    color: white;
    width: 100%;
    margin-top: 10px;
}

.submit-btn:hover {
    background-color: #27ae60;
}

/* Recipient and Approval Fields */
#recipientField, #approvalFields {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
}

#approvalFields .form-group {
    margin-bottom: 10px;
}

/* Tables */
.transaction-history {
    margin-top: 30px;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #3498db;
    color: white;
    font-weight: 600;
}

tr:hover {
    background-color: #f5f5f5;
}

/* Action Buttons */
.action-btn {
    padding: 6px 10px;
    margin: 2px;
    border-radius: 3px;
    font-size: 14px;
    min-width: 70px;
}

.edit-btn {
    background-color: #3498db;
    color: white;
}

.delete-btn {
    background-color: #e74c3c;
    color: white;
}

.repay-btn {
    background-color: #f39c12;
    color: white;
}

.print-btn {
    background-color: #9b59b6;
    color: white;
}

/* Messages */
.message {
    padding: 12px;
    margin: 15px 0;
    border-radius: 4px;
    display: none;
}

.error {
    background-color: #fadbd8;
    color: #c0392b;
    border-left: 4px solid #e74c3c;
}

.success {
    background-color: #d5f5e3;
    color: #27ae60;
    border-left: 4px solid #2ecc71;
}

/* Authentication Styles */
#auth-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#auth-container h2 {
    text-align: center; /* Center the title */
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.auth-buttons button {
    width: 100%;
    margin: 5px 0;
    padding: 12px;
}

#login-btn {
    background-color: #3498db;
}

#signup-btn {
    background-color: #2ecc71;
}

#reset-btn {
    background-color: #95a5a6;
}

.contact-details {
    color: #27ae60; /* Green color matching the positive/success theme */
    font-size: 14px;
    text-align: center;
    margin-top: 15px;
    font-weight: 500;
}

/* Action Buttons Container */
.action-buttons {
    margin: 25px 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-buttons button {
    flex: 1;
    min-width: 120px;
}

.report-btn {
    background-color: #3498db;
    color: white;
}

.export-btn {
    background-color: #9b59b6;
    color: white;
}

.logout-btn {
    background-color: #e74c3c;
    color: white;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow: auto;
    padding: 20px;
}

.modal-content {
    background: white;
    margin: 20px auto;
    padding: 25px;
    max-width: 900px;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.close-btn {
    background: #e74c3c;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.report-controls, .report-filters {
    margin: 20px 0;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.control-group, .filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select, .search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 150px;
}

/* Enhanced Report Styles */
.report-section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #f9f9f9;
}

.report-chart-container {
    margin: 20px 0;
}

.report-summary-card {
    display: inline-block;
    width: 22%;
    margin: 1%;
    padding: 20px;
    background: white;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.report-summary-card .amount {
    font-size: 1.8em;
    font-weight: bold;
    margin: 15px 0;
}

/* Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .balance-summary {
        flex-direction: column;
        gap: 10px;
    }
    
    .report-summary-card {
        width: 100%;
        margin: 10px 0;
    }
    
    .report-controls, .report-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .control-group, .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select, .search-input {
        width: 100%;
    }
    
    .action-buttons button {
        flex: 1 0 100%;
    }
    
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px 10px;
    }
}

/* Specific Fixes */
#category {
    display: block !important;
    width: 100%;
    margin: 5px 0;
}

#recipient {
    display: block;
    width: 100%;
}

#approvalFields {
    display: block;
    margin: 15px 0 0 0;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
}

#approvalFields input {
    width: 100%;
    margin: 5px 0;
}

/* Add these styles to ensure proper display */
#recipientField {
    display: none; /* Hidden by default */
    margin-top: 15px;
}

#recipientField label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

#recipientField input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

/* Voucher ID styling in table */
.voucher-id {
    font-weight: bold;
    color: #2c3e50;
}

/* Search input styling */
.search-group {
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Table caption styling */
table caption {
    caption-side: top;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    padding: 10px 0;
}

/* Enhanced Report Print-Specific Styles */
@media print {
    .modal {
        display: block !important;
        position: static;
        background: none;
        padding: 0;
    }
    .modal-content {
        box-shadow: none;
        margin: 0;
        padding: 10px;
        max-width: 100%;
    }
    .report-controls, .report-filters {
        DISPLAY: NONE !important;
    }
    .report-content {
        max-height: none;
        overflow: visible;
    }
    .report-chart-container canvas {
        display: none;
    }
    .report-table {
        page-break-inside: auto;
    }
    .report-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

.report-chart-container {
    margin: 20px 0;
    width: 48%;
    min-height: 350px; /* Ensure enough space for charts */
}

.report-chart-container canvas {
    width: 100% !important;
    height: 300px !important;
}