/* EMI Calculator - Main Stylesheet */

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --light-bg: #f8fafc;
    --dark-text: #1f2937;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark-text);
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Card */
.main-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

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

.btn-success:hover {
    background: #047857;
    transform: translateY(-2px);
}

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

.btn-warning:hover {
    background: #b45309;
    transform: translateY(-2px);
}

.btn-full {
    width: 100%;
    margin-bottom: 20px;
}

/* Grid Layout */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -10px;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 10px;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    padding: 10px;
}

.col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 10px;
}

/* Results Section */
.results-section {
    background: var(--light-bg);
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
    border-left: 4px solid var(--primary-color);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.result-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.result-item:hover {
    transform: translateY(-5px);
}

.result-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
}

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

.result-value.success {
    color: var(--success-color);
}

.result-value.warning {
    color: var(--warning-color);
}

/* EMI Schedule Table */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.table-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.export-buttons {
    display: flex;
    gap: 10px;
}

.export-buttons .btn {
    padding: 8px 16px;
    font-size: 14px;
}

.table-responsive {
    overflow-x: auto;
}

.emi-table {
    width: 100%;
    border-collapse: collapse;
}

.emi-table th,
.emi-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.emi-table th {
    background: var(--light-bg);
    font-weight: 600;
    color: var(--dark-text);
    position: sticky;
    top: 0;
    z-index: 10;
}

.emi-table tr:hover {
    background: #f9fafb;
}

.emi-table td.amount {
    text-align: right;
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    gap: 10px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-info {
    margin: 0 15px;
    font-size: 14px;
    color: #6b7280;
}

/* Loading Spinner */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

/* Error Messages */
.error-message {
    background: #fef2f2;
    color: var(--danger-color);
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid var(--danger-color);
    margin-bottom: 20px;
    font-size: 14px;
}

.success-message {
    background: #f0fdf4;
    color: var(--success-color);
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
    margin-bottom: 20px;
    font-size: 14px;
}

/* Hidden Elements */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .col-md-6,
    .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .main-card {
        padding: 20px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .export-buttons {
        justify-content: center;
    }
    
    .emi-table {
        font-size: 14px;
    }
    
    .emi-table th,
    .emi-table td {
        padding: 8px 10px;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .pagination button {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .main-card {
        padding: 15px;
    }
    
    .result-value {
        font-size: 20px;
    }
    
    .emi-table {
        font-size: 12px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .main-card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .btn,
    .export-buttons,
    .pagination {
        display: none;
    }
    
    .table-container {
        box-shadow: none;
    }
}