/* CSS Variables for Theme Support */
:root {
    /* Light Theme Colors */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-card: rgba(255, 255, 255, 0.9);
    --text-primary: #333;
    --text-secondary: #666;
    --text-accent: #667eea;
    --border-color: rgba(255, 255, 255, 0.2);
    --shadow-light: 0 15px 35px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 10px 25px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.2);
    --accent-gradient: linear-gradient(135deg, #667eea, #764ba2);
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --error-color: #f44336;
    --info-color: #2196F3;
}

/* Dark Theme Colors */
[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    --bg-secondary: rgba(26, 26, 46, 0.95);
    --bg-card: rgba(22, 33, 62, 0.9);
    --text-primary: #e0e6ed;
    --text-secondary: #a0a6b8;
    --text-accent: #64ffda;
    --border-color: rgba(100, 255, 218, 0.2);
    --shadow-light: 0 15px 35px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.5);
    --accent-gradient: linear-gradient(135deg, #64ffda, #00bcd4);
    --success-color: #00e676;
    --warning-color: #ffab00;
    --error-color: #ff5252;
    --info-color: #40c4ff;
}

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

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    transition: all 0.3s ease;
}

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

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    animation: fadeInDown 1s ease-out;
}

.header-content {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    flex: 1;
    text-align: center;
    transition: all 0.3s ease;
}

.header-icon {
    font-size: 3rem;
    color: var(--text-accent);
    margin-bottom: 15px;
    animation: bounce 2s infinite;
}

.header-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.header-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Theme Toggle */
.theme-toggle {
    margin-left: 20px;
}

.theme-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-accent);
    font-size: 1.5rem;
    box-shadow: var(--shadow-medium);
}

.theme-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-heavy);
    border-color: var(--text-accent);
}

.theme-btn:active {
    transform: translateY(0) scale(0.95);
}

/* Main Content */
.main-content {
    display: grid;
    gap: 30px;
}

/* Input Section */
.input-section {
    animation: fadeInLeft 1s ease-out 0.2s both;
}

.form-container {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.form-container:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-title i {
    color: var(--text-accent);
    font-size: 1.5rem;
}

/* Form Styles */
.emi-form {
    display: grid;
    gap: 25px;
}

.input-group {
    position: relative;
    animation: slideInUp 0.6s ease-out;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1rem;
}

.input-label i {
    color: var(--text-accent);
    font-size: 1.1rem;
}

.input-field {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px rgba(100, 255, 218, 0.1);
    transform: translateY(-2px);
}

.input-field:hover {
    border-color: var(--text-accent);
}

.input-unit {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
    pointer-events: none;
    margin-top: 20px;
}

.tenure-container {
    display: flex;
    gap: 15px;
}

.tenure-select {
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.tenure-select:focus {
    outline: none;
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px rgba(100, 255, 218, 0.1);
}

/* Button Styles */
.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-calculate {
    background: var(--accent-gradient);
    color: white;
    flex: 1;
    min-width: 200px;
    justify-content: center;
}

.btn-calculate:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-heavy);
}

.btn-reset {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-reset:hover {
    background: var(--text-accent);
    color: white;
    transform: translateY(-3px);
}

.btn-voice {
    background: var(--info-color);
    color: white;
    border: 2px solid var(--info-color);
}

.btn-voice:hover {
    background: transparent;
    color: var(--info-color);
    transform: translateY(-3px);
}

.btn-voice:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Results Section */
.results-section {
    animation: fadeInRight 1s ease-out 0.4s both;
}

.results-container {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

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

.result-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-gradient);
    transition: width 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.result-card:hover::before {
    width: 100%;
    opacity: 0.1;
}

.result-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.monthly-emi .result-icon {
    background: var(--success-color);
}

.total-interest .result-icon {
    background: var(--warning-color);
}

.total-amount .result-icon {
    background: var(--info-color);
}

.result-content h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 500;
}

.result-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* Chart Section */
.chart-section {
    margin: 40px 0;
    padding: 30px;
    background: var(--bg-card);
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.chart-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-title i {
    color: var(--text-accent);
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* Breakdown Section */
.breakdown-section {
    margin-top: 40px;
}

.breakdown-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 12px 25px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1rem;
}

.tab-btn.active,
.tab-btn:hover {
    color: var(--text-accent);
    border-bottom-color: var(--text-accent);
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.tab-content.active {
    display: block;
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.breakdown-table th {
    background: var(--text-accent);
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.breakdown-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

.breakdown-table tr:hover td {
    background: rgba(100, 255, 218, 0.05);
}

.breakdown-table tr:nth-child(even) td {
    background: rgba(100, 255, 218, 0.02);
}

/* Info Section */
.info-section {
    animation: fadeInUp 1s ease-out 0.6s both;
}

.info-container {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.info-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-gradient);
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.info-card h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-card h3 i {
    color: var(--text-accent);
}

.info-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Voice Modal */
.voice-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.voice-modal-content {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-heavy);
    max-width: 400px;
    width: 90%;
}

.voice-animation {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 20px;
}

.voice-circle {
    width: 12px;
    height: 12px;
    background: var(--text-accent);
    border-radius: 50%;
    animation: voicePulse 1.5s ease-in-out infinite;
}

.voice-circle:nth-child(2) {
    animation-delay: 0.2s;
}

.voice-circle:nth-child(3) {
    animation-delay: 0.4s;
}

#voiceStatus {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 20px;
}

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

.btn-stop:hover {
    background: #d32f2f;
}

/* Footer */
.footer {
    margin-top: 60px;
    text-align: center;
    animation: fadeInUp 1s ease-out 0.8s both;
}

.footer-content {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.footer-content p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.disclaimer {
    font-size: 0.9rem;
    font-style: italic;
}

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

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

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes voicePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 20px;
    }
    
    .header-content {
        padding: 25px;
    }
    
    .header-title {
        font-size: 2rem;
    }
    
    .form-container,
    .results-container,
    .info-container {
        padding: 25px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .breakdown-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        text-align: center;
        border-bottom: none;
        border-left: 3px solid transparent;
        padding: 15px;
    }
    
    .tab-btn.active,
    .tab-btn:hover {
        border-left-color: var(--text-accent);
        border-bottom-color: transparent;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .tenure-container {
        flex-direction: column;
    }
    
    .tenure-select {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .result-value {
        font-size: 1.5rem;
    }
    
    .breakdown-table {
        font-size: 0.8rem;
    }
    
    .breakdown-table th,
    .breakdown-table td {
        padding: 8px 6px;
    }
}
