/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #334155;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #473289 0%, #5b4a9a 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(71, 50, 137, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.brand-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    text-align: center;
}

.brand-info h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    color: #ffffff;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tagline {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e2e8f0;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.description {
    font-size: 0.8rem;
    color: #cbd5e1;
    margin: 0;
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Calculator Section */
.calculator-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.input-panel {
    padding: 2rem;
    border-bottom: 1px solid #e2e8f0;
}

.input-panel h2 {
    color: #473289;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #473289;
    box-shadow: 0 0 0 3px rgba(71, 50, 137, 0.1);
}

.form-control:hover {
    border-color: #cbd5e1;
}

/* Button Styles */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    justify-content: center;
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.button-group .btn {
    flex: 1;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, #473289 0%, #5b4a9a 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(71, 50, 137, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(100, 116, 139, 0.3);
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 100%;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.results-actions {
    display: flex;
    gap: 0.5rem;
}

.results-section h2 {
    color: #473289;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #473289;
    text-align: center;
}

.summary-card h3 {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #473289;
}

/* Schedule Tabs */
.schedule-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn.active {
    background: #473289;
    color: white;
}

.tab-btn:hover:not(.active) {
    background: #f1f5f9;
    color: #473289;
}

/* Schedule Table */
.schedule-table-container {
    max-height: 600px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    width: 100%;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.schedule-table th {
    background: #f8fafc;
    color: #374151;
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.schedule-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.schedule-table tbody tr:hover {
    background: #f8fafc;
}

.schedule-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.schedule-table tbody tr.has-transactions {
    background: #f0f9ff !important;
    border-left: 3px solid #473289;
}

.transactions-cell {
    font-size: 0.8rem;
    max-width: 200px;
    word-wrap: break-word;
}

.transaction-item {
    background: #e0e7ff;
    border: 1px solid #c7d2fe;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 2px 0;
    font-size: 0.75rem;
}

/* Transactions Section */
.transactions-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-top: 2rem;
}

.transactions-section h2 {
    color: #473289;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.transactions-panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
}

.transactions-summary h3 {
    color: #374151;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #473289;
    text-align: center;
}

.stat-card h4 {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #473289;
}

.transactions-table-container {
    max-height: 500px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.85rem;
}

.transactions-table th {
    background: #f8fafc;
    color: #374151;
    font-weight: 600;
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 0.8rem;
}

.transactions-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.transactions-table tbody tr:hover {
    background: #f8fafc;
}

.transactions-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.transaction-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.transaction-type.repayment {
    background: #dcfce7;
    color: #166534;
}

.transaction-type.part_payment {
    background: #dbeafe;
    color: #1e40af;
}

.transaction-type.moratorium {
    background: #fef3c7;
    color: #92400e;
}

.transaction-type.restructure {
    background: #fce7f3;
    color: #be185d;
}

/* Saved Cases Section */
.saved-cases-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-top: 2rem;
}

.saved-cases-section h2 {
    color: #473289;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.saved-cases-panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
}

.cases-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.case-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid #473289;
    cursor: pointer;
    transition: all 0.3s ease;
}

.case-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.case-card h4 {
    color: #473289;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.case-card p {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

.case-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.case-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    min-width: auto;
    flex: none;
}

.no-cases {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 2rem;
}

/* Loading Spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #473289;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.loading p {
    color: #473289;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .input-panel,
    .results-panel,
    .events-section {
        padding: 1.5rem;
    }
    
    .schedule-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .schedule-table-container {
        max-height: 400px;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* Saved Cases Section */
.saved-cases-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 100%;
    margin-top: 2rem;
}

.saved-cases-section h2 {
    color: #473289;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.saved-cases-panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
}

.cases-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.case-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.case-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #473289;
}

.case-card h3 {
    color: #473289;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.case-card p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.case-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.case-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.no-cases {
    text-align: center;
    color: #64748b;
    font-style: italic;
    grid-column: 1 / -1;
    padding: 2rem;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

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

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Footer Styles */
.footer {
    background: transparent;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.footer-info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
}

.footer-info p {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
    font-weight: 400;
}

.footer-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.footer-details p {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0;
    font-weight: 400;
}

.footer-details p:first-child {
    font-weight: 500;
    color: #64748b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .brand-info h1 {
        font-size: 1.5rem;
    }
    
    .footer-content {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem 0;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .brand-info h1 {
        font-size: 1.3rem;
    }
    
    .tagline {
        font-size: 0.8rem;
    }
    
    .description {
        font-size: 0.7rem;
    }
}
