/**
 * FeeFlow Styles
 * Save this file as: assets/css/feeflow.css
 */

:root {
    --primary-color: #0073aa;
    --primary-hover: #005a87;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #212529;
    --text-muted: #6c757d;
}

* {
    box-sizing: border-box;
}

.feeflow-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-color);
}

/* Navigation */
.feeflow-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    flex-wrap: wrap;
}

.feeflow-nav-btn {
    flex: 1;
    min-width: 180px;
    padding: 14px 20px;
    border: 2px solid var(--border-color);
    background: white;
    color: var(--text-color);
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.feeflow-nav-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #f0f8ff;
    transform: translateY(-2px);
}

.feeflow-nav-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.feeflow-nav-btn svg {
    flex-shrink: 0;
}

/* Sections */
.feeflow-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.feeflow-section.active {
    display: block;
}

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

/* Header */
.feeflow-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.feeflow-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--text-color);
}

.feeflow-subtitle {
    color: var(--text-muted);
    margin: 5px 0 0 0;
    font-size: 14px;
}

/* Dashboard Month Subtitle - Make it prominent */
.dashboard-current-month {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 8px 0 0 0;
}

/* Cards */
.feeflow-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
}

.feeflow-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: var(--text-color);
}

.card-description {
    color: var(--text-muted);
    margin: 0 0 20px 0;
    font-size: 14px;
}

/* Forms */
.feeflow-form-group {
    margin-bottom: 20px;
    flex: 1;
    min-width: 200px;
}

.feeflow-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.feeflow-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.5;
    transition: all 0.3s ease;
    font-family: inherit;
    background: white;
    color: var(--text-color);
    min-height: 45px;
}

.feeflow-input option {
    color: #000000;
    background: #ffffff;
    padding: 12px;
    line-height: 1.8;
    font-size: 15px;
}

.feeflow-input select option {
    color: #000000;
}

.feeflow-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.feeflow-input:disabled {
    background: var(--light-gray);
    cursor: not-allowed;
    color: var(--text-muted);
}

/* Ensure select dropdowns have readable text and proper height */
select.feeflow-input {
    appearance: auto;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    height: auto;
    min-height: 45px;
    padding-top: 10px;
    padding-bottom: 10px;
}

select.feeflow-input option {
    color: #000000;
    background-color: #ffffff;
    font-size: 15px;
    padding: 10px 12px;
    line-height: 2;
    height: auto;
    min-height: 40px;
}

/* Firefox specific fixes */
@-moz-document url-prefix() {
    select.feeflow-input option {
        padding: 8px;
    }
}

.feeflow-form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* Three-column form row */
.feeflow-form-row-three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

/* Make monthly fee input larger and more prominent */
.feeflow-form-group.fee-input-group {
    flex: 1 1 100%;
    max-width: 400px;
}

#student-fee,
#modal-student-fee {
    font-size: 18px;
    font-weight: 600;
    padding: 16px 20px;
    min-height: 55px;
    width: 100%;
}

.feeflow-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    justify-content: flex-end;
    flex-wrap: wrap;
    align-items: center;
}

.feeflow-form-actions .feeflow-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Buttons */
.feeflow-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.feeflow-btn-primary {
    background: var(--primary-color);
    color: white;
}

.feeflow-btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.feeflow-btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.feeflow-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.feeflow-btn-success {
    background: var(--success-color);
    color: white;
}

.feeflow-btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.feeflow-btn-danger {
    background: var(--danger-color);
    color: white;
}

.feeflow-btn-danger:hover {
    background: #c82333;
}

.feeflow-btn-warning {
    background: var(--warning-color);
    color: var(--text-color);
}

.feeflow-btn-warning:hover {
    background: #e0a800;
}

.feeflow-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.feeflow-btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* Student Search Results */
.student-results {
    position: absolute;
    background: white;
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    width: calc(100% - 60px);
    z-index: 1000;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    display: none;
}

.student-results.active {
    display: block;
}

.student-result-item {
    padding: 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.student-result-item:last-child {
    border-bottom: none;
}

.student-result-item:hover {
    background: var(--light-gray);
}

.student-result-item strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
    font-size: 15px;
}

.student-result-item span {
    color: var(--text-muted);
    font-size: 13px;
}

/* Student Info Card */
.student-info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.student-info-card h3 {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.student-info-card p {
    margin: 8px 0;
    font-size: 15px;
    opacity: 0.95;
}

.student-info-card strong {
    font-weight: 600;
}

/* Tables */
.feeflow-table-container {
    overflow-x: auto;
    margin-top: 20px;
}

.feeflow-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.feeflow-table thead {
    background: var(--light-gray);
}

.feeflow-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.feeflow-table td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--border-color);
}

.feeflow-table tbody tr {
    transition: background 0.2s ease;
}

.feeflow-table tbody tr:hover {
    background: var(--light-gray);
}

.text-center {
    text-align: center;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Table Controls */
.feeflow-table-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.feeflow-table-controls .feeflow-input {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

/* Report Header */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

/* Loader */
.feeflow-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.feeflow-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    background: var(--text-color);
    color: white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
    max-width: 400px;
    font-size: 15px;
}

.feeflow-toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.feeflow-toast.success {
    background: var(--success-color);
}

.feeflow-toast.error {
    background: var(--danger-color);
}

.feeflow-toast.warning {
    background: var(--warning-color);
    color: var(--text-color);
}

/* Action Buttons Group */
.action-buttons {
    display: flex;
    gap: 8px;
}

/* Error Message */
.feeflow-error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    text-align: center;
    font-size: 16px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 20px;
    margin: 0 0 10px 0;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Modal Styles */
.feeflow-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.feeflow-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.feeflow-modal-header {
    padding: 25px 30px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feeflow-modal-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-color);
}

.feeflow-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    font-weight: 300;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.feeflow-modal-close:hover {
    background: var(--light-gray);
    color: var(--text-color);
}

.feeflow-modal-body {
    padding: 30px;
}

.feeflow-modal-body .feeflow-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.feeflow-modal-body .feeflow-form-actions .feeflow-btn {
    flex: 0 0 auto;
    min-width: 140px;
}

/* Scrollbar Styling */
.feeflow-table-container::-webkit-scrollbar,
.student-results::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.feeflow-table-container::-webkit-scrollbar-track,
.student-results::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 4px;
}

.feeflow-table-container::-webkit-scrollbar-thumb,
.student-results::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.feeflow-table-container::-webkit-scrollbar-thumb:hover,
.student-results::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Date picker styling */
.feeflow-datepicker,
.feeflow-monthpicker {
    cursor: pointer;
}

.feeflow-datepicker[type="date"],
.feeflow-monthpicker[type="month"] {
    position: relative;
}

.feeflow-datepicker[type="date"]::-webkit-calendar-picker-indicator,
.feeflow-monthpicker[type="month"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
}

.feeflow-datepicker[type="date"]:hover::-webkit-calendar-picker-indicator,
.feeflow-monthpicker[type="month"]:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
}

/* WhatsApp Reminder Button */
.whatsapp-reminder-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #25D366;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.whatsapp-reminder-btn:hover {
    background: #20BA5A;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    color: white;
    text-decoration: none;
}

.whatsapp-reminder-btn svg {
    flex-shrink: 0;
}

.whatsapp-reminder-btn span {
    display: inline-block;
}

/* Download Receipt Button */
.download-receipt {
    white-space: nowrap;
}

.download-receipt svg {
    flex-shrink: 0;
}

/* Dashboard Section */
.feeflow-dashboard {
    margin-top: 30px;
}

/* Dashboard Stats Cards */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-blue .stat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-card-green .stat-icon {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.stat-card-success .stat-icon {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    color: white;
}

.stat-card-warning .stat-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
}

/* Progress Bar */
.progress-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-gray);
    border-radius: 8px;
}

.progress-stat {
    text-align: center;
}

.progress-stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.progress-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar {
    flex: 1;
    height: 30px;
    background: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #56ab2f 0%, #a8e063 100%);
    border-radius: 15px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
}

.progress-percentage {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    min-width: 60px;
    text-align: right;
}

/* Chart Container */
.chart-container {
    max-width: 400px;
    margin: 30px auto;
    position: relative;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-color-paid {
    background: #56ab2f;
}

.legend-color-unpaid {
    background: #f5576c;
}

.legend-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .feeflow-form-row-three {
        grid-template-columns: 1fr 1fr;
    }
    
    .feeflow-form-row-three .feeflow-form-group:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .feeflow-container {
        padding: 0 15px;
        margin: 20px auto;
    }

    .feeflow-nav {
        flex-direction: column;
    }

    .feeflow-nav-btn {
        width: 100%;
    }

    .feeflow-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .feeflow-card {
        padding: 20px;
    }

    .feeflow-form-row {
        flex-direction: column;
    }
    
    .feeflow-form-row-three {
        grid-template-columns: 1fr;
    }
    
    .feeflow-form-row .feeflow-form-group:has(#student-fee),
    .feeflow-form-row .feeflow-form-group:has(#modal-student-fee) {
        max-width: 100%;
    }

    .feeflow-form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .feeflow-form-actions .feeflow-btn {
        width: 100%;
    }

    .feeflow-btn {
        width: 100%;
        justify-content: center;
    }

    .feeflow-table-controls {
        flex-direction: column;
    }

    .feeflow-table-controls .feeflow-input {
        max-width: 100%;
    }

    .report-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .feeflow-toast {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }

    .student-results {
        width: calc(100% - 30px);
    }
    
    .feeflow-modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .feeflow-modal-body {
        padding: 20px;
    }
    
    .feeflow-modal-header {
        padding: 20px;
    }
    
    .whatsapp-reminder-btn span {
        display: none;
    }
    
    .whatsapp-reminder-btn {
        padding: 10px;
        justify-content: center;
    }
    
    /* Dashboard Responsive */
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .progress-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .progress-bar-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .progress-percentage {
        text-align: center;
    }
    
    .chart-container {
        max-width: 100%;
    }
    
    .chart-legend {
        flex-direction: column;
        gap: 10px;
    }
}

/* Print Styles */
@media print {
    .feeflow-nav,
    .feeflow-header button,
    .feeflow-table-controls,
    .action-buttons,
    .feeflow-form-actions {
        display: none !important;
    }

    .feeflow-card {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease;
}