/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header styles */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Calculator section */
.calculator-section {
    background: white;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

.input-section {
    padding: 30px;
    background: #f8f9fa;
}

.input-section h2 {
    margin-bottom: 25px;
    color: #2c3e50;
    font-size: 1.8rem;
    text-align: center;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tenure-inputs {
    display: flex;
    gap: 10px;
}

.tenure-inputs input {
    flex: 1;
}

.input-group small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.875rem;
}

.calculate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 10px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Summary section */
.summary-section {
    padding: 30px;
    background: white;
    border-top: 1px solid #e1e8ed;
}

.summary-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.6rem;
    text-align: center;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

@media (max-width: 600px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
}

.summary-item {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.summary-item.featured {
    background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
    border-left: 4px solid #28a745;
    font-weight: 600;
    text-align: center;
}

.summary-item label {
    display: block;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 8px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-item span {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

/* Table section */
.table-section {
    background: white;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

.table-controls {
    padding: 30px 30px 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.table-controls h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin: 0;
}

.export-controls {
    display: flex;
    gap: 10px;
}

.export-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.export-btn:hover {
    background: #667eea;
    color: white;
}

.table-container {
    overflow-x: auto;
    padding: 0 30px 30px 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 20px;
}

thead {
    background: #667eea;
    color: white;
}

th, td {
    padding: 12px 8px;
    text-align: right;
    border-bottom: 1px solid #e1e8ed;
}

th {
    font-weight: 600;
    text-align: center;
    position: sticky;
    top: 0;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody tr:nth-child(even) {
    background: #fafbfc;
}

/* Editable cells */
.editable {
    background: #fff3cd;
    border: 2px solid #ffc107;
    cursor: pointer;
    transition: all 0.2s ease;
}

.editable:hover {
    background: #ffeaa7;
}

.editable:focus {
    outline: none;
    background: #fff;
    border-color: #667eea;
}

/* Error message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
    text-align: center;
    font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .input-section,
    .summary-section,
    .table-controls {
        padding: 20px;
    }

    .table-container {
        padding: 0 20px 20px 20px;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .tenure-inputs {
        flex-direction: column;
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .export-controls {
        justify-content: center;
    }

    th, td {
        padding: 8px 4px;
        font-size: 0.8rem;
    }

    .summary-item span {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .input-section,
    .summary-section,
    .table-controls {
        padding: 15px;
    }

    .table-container {
        padding: 0 15px 15px 15px;
    }

    th, td {
        padding: 6px 2px;
        font-size: 0.75rem;
    }

    .export-controls {
        flex-direction: column;
    }

    .export-btn {
        width: 100%;
    }
}

/* Loading animation */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Success animation */
.success {
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Footer styles */
.footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 40px 0 20px 0;
    margin-top: 50px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    color: #3498db;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.footer-section ol,
.footer-section ul {
    padding-left: 20px;
}

.footer-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.footer-section p {
    margin-bottom: 12px;
    line-height: 1.6;
}

.footer-section strong {
    color: #f39c12;
}

.footer-branding {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #4a5f7a;
    color: #bdc3c7;
}

.footer-branding p {
    margin: 5px 0;
    font-size: 1.1rem;
}

.footer-branding strong {
    color: #3498db;
    font-size: 1.2rem;
}

/* Footer responsive design */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .footer {
        padding: 30px 0 15px 0;
    }

    .footer-section h3 {
        font-size: 1.2rem;
    }
}