/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2196F3;
    --secondary-color: #1976D2;
    --accent-color: #4CAF50;
    --danger-color: #F44336;
    --warning-color: #FF9800;
    --light-bg: #f5f5f5;
    --light-card: #ffffff;
    --light-text: #333333;
    --light-border: #e0e0e0;
    --dark-bg: #1a1a1a;
    --dark-card: #2d2d2d;
    --dark-text: #ffffff;
    --dark-border: #404040;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: var(--transition);
    min-height: 100vh;
    overflow-x: hidden;
}

body.light-mode {
    background-color: var(--light-bg);
    color: var(--light-text);
}

body.dark-mode {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

/* Navigation Bar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.nav-icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    min-width: 160px;
    box-shadow: var(--shadow);
    border-radius: 8px;
    z-index: 1001;
}

body.dark-mode .dropdown-content {
    background-color: var(--dark-card);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--light-text);
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

body.dark-mode .dropdown-content a {
    color: var(--dark-text);
}

.dropdown-content a:hover {
    background-color: var(--light-border);
}

body.dark-mode .dropdown-content a:hover {
    background-color: var(--dark-border);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--light-card);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    z-index: 1002;
    display: flex;
    flex-direction: column;
}

body.dark-mode .sidebar {
    background: var(--dark-card);
}

.sidebar.show {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1001;
}

.sidebar-overlay.show {
    display: block;
}

.sidebar-header {
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    text-align: center;
    color: white;
}

.sidebar-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-menu {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--light-text);
    text-decoration: none;
    transition: var(--transition);
}

body.dark-mode .sidebar-item {
    color: var(--dark-text);
}

.sidebar-item:hover {
    background: var(--light-border);
}

body.dark-mode .sidebar-item:hover {
    background: var(--dark-border);
}

.sidebar-item i {
    width: 24px;
    text-align: center;
}

/* Main Content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.logo-container {
    text-align: center;
    margin: 2rem 0;
}

.logo-container img {
    width: 100px;
    height: 100px;
    object-fit: contain;
}

/* Form Card */
.form-card {
    background: var(--light-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

body.dark-mode .form-card {
    background: var(--dark-card);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--light-text);
}

body.dark-mode .form-group label {
    color: var(--dark-text);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 1rem;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.input-with-icon input,
.input-with-icon select {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--light-border);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
    background: transparent;
    color: var(--light-text);
}

body.dark-mode .input-with-icon input,
body.dark-mode .input-with-icon select {
    border-color: var(--dark-border);
    color: var(--dark-text);
}

.input-with-icon input:focus,
.input-with-icon select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Buttons */
.form-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-calculate,
.btn-reset,
.btn-speak-result,
.btn-toggle-tts,
.btn-scroll-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
}

.btn-calculate {
    background: linear-gradient(135deg, #333, #000);
    color: white;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-reset {
    background: transparent;
    border: 2px solid var(--light-text);
    color: var(--light-text);
}

body.dark-mode .btn-reset {
    border-color: var(--dark-text);
    color: var(--dark-text);
}

.btn-reset:hover {
    background: var(--light-border);
}

body.dark-mode .btn-reset:hover {
    background: var(--dark-border);
}

/* Results Card */
.results-card {
    background: var(--light-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

body.dark-mode .results-card {
    background: var(--dark-card);
}

.results-card h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.monthly-payment {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(25, 118, 210, 0.1));
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
}

.monthly-payment div:first-child {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--light-text);
}

body.dark-mode .monthly-payment div:first-child {
    color: var(--dark-text);
}

.payment-amount {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    overflow-x: auto;
    white-space: nowrap;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-item {
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid transparent;
}

.total-interest {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.3);
}

.total-payment {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
}

.result-item div:first-child {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.amount {
    font-size: 1.5rem;
    font-weight: 700;
}

.total-interest .amount {
    color: var(--danger-color);
}

.total-payment .amount {
    color: var(--accent-color);
}

.conversion-note {
    text-align: center;
    font-style: italic;
    color: var(--primary-color);
    padding: 1rem;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Amortization Table */
.amortization-card {
    background: var(--light-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

body.dark-mode .amortization-card {
    background: var(--dark-card);
}

.amortization-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--light-border);
    border-radius: 10px;
}

body.dark-mode .table-container {
    border-color: var(--dark-border);
}

#amortizationTable {
    width: 100%;
    border-collapse: collapse;
}

#amortizationTable thead {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.2), rgba(25, 118, 210, 0.2));
}

#amortizationTable th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 1px solid var(--light-border);
}

body.dark-mode #amortizationTable th {
    border-color: var(--dark-border);
}

#amortizationTable tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

body.dark-mode #amortizationTable tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

#amortizationTable td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--light-border);
}

body.dark-mode #amortizationTable td {
    border-color: var(--dark-border);
}

.payment-cell {
    color: #4CAF50;
    font-weight: 600;
}

.interest-cell {
    color: #F44336;
    font-weight: 600;
}

.principal-cell {
    color: #2196F3;
    font-weight: 600;
}

.color-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.btn-speak-result {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    color: white;
}

.btn-toggle-tts {
    background: linear-gradient(135deg, #607D8B, #455A64);
    color: white;
}

.btn-scroll-top {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    width: 100%;
    margin-bottom: 2rem;
}

.btn-speak-result:hover,
.btn-toggle-tts:hover,
.btn-scroll-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Refresh Indicator */
.refresh-indicator {
    position: fixed;
    top: -60px;
    left: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    z-index: 999;
}

.refresh-indicator.show {
    top: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .form-card,
    .results-card,
    .amortization-card {
        padding: 1.5rem;
    }
    
    .form-buttons,
    .action-buttons,
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .payment-amount {
        font-size: 2rem;
    }
    
    .amount {
        font-size: 1.2rem;
    }
    
    .nav-right {
        gap: 0.25rem;
    }
    
    .nav-icon-btn {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .navbar h1 {
        font-size: 1.2rem;
    }
    
    .sidebar {
        width: 250px;
    }
    
    .monthly-payment {
        padding: 1rem;
    }
    
    .payment-amount {
        font-size: 1.8rem;
    }
}


/* Footer Styles */
.footer {
    background: linear-gradient(135deg, #1a237e, #283593);
    color: white;
    padding: 3rem 0 1rem 0;
    margin-top: 4rem;
    border-top: 4px solid #2196F3;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 3px;
    background: #2196F3;
    border-radius: 2px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: #bbbbbb;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-links a:hover {
    color: #2196F3;
    transform: translateX(5px);
}

.footer-links a i {
    font-size: 0.9rem;
    width: 20px;
}

/* Play Store Button */
.play-store-btn {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #34A853, #0D652D);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #34A853;
    box-shadow: 0 4px 15px rgba(52, 168, 83, 0.3);
    margin-top: 1rem;
}

.play-store-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(52, 168, 83, 0.4);
    background: linear-gradient(135deg, #0D652D, #34A853);
}

.play-store-btn i {
    font-size: 2rem;
}

.play-store-btn .btn-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.play-store-btn .btn-text span:first-child {
    font-size: 0.8rem;
    opacity: 0.9;
}

.play-store-btn .btn-text span:last-child {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Contact Info */
.contact-info {
    margin-top: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    color: #bbbbbb;
}

.contact-item i {
    color: #2196F3;
    font-size: 1.2rem;
    width: 24px;
}

/* Social Media */
.social-media {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: #2196F3;
    transform: translateY(-3px);
}

/* Newsletter */
.newsletter-form {
    margin-top: 1.5rem;
}

.newsletter-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.newsletter-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.newsletter-btn {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.newsletter-btn:hover {
    background: linear-gradient(135deg, #1976D2, #2196F3);
    transform: translateY(-2px);
}

/* Copyright */
.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #bbbbbb;
    font-size: 0.9rem;
}

.footer-bottom-links {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-bottom-links a {
    color: #bbbbbb;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-bottom-links a:hover {
    color: #2196F3;
}

/* Badges */
.app-badges {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.badge:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.badge i {
    font-size: 1.2rem;
}

/* Dark Mode Adjustments */
body.dark-mode .footer {
    background: linear-gradient(135deg, #0d1b2a, #1b263b);
}

body.dark-mode .play-store-btn {
    box-shadow: 0 4px 15px rgba(52, 168, 83, 0.2);
}

/* Responsive Footer */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-container {
        padding: 0 1rem;
    }
    
    .footer-bottom-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .play-store-btn {
        width: 100%;
        justify-content: center;
    }
    
    .social-media {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 2rem 0 1rem 0;
    }
    
    .footer-section h3 {
        font-size: 1.1rem;
    }
    
    .play-store-btn .btn-text span:last-child {
        font-size: 1rem;
    }
}