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

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

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

/* Header Styles */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

nav {
    display: flex;
    gap: 30px;
}

nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

nav a:hover {
    color: #3467a7;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #3467a7;
    transition: width 0.3s ease;
}

nav a:hover::after {
    width: 100%;
}

/* Calculator Section */
.calculator-section {
    padding: 40px 0 20px 0;
}

.calculator-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.calculator-form h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 0.95rem;
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

.currency-select {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 12px 15px;
    font-size: 1rem;
    font-weight: 500;
    color: #495057;
    min-width: 100px;
    transition: all 0.3s ease;
}

input[type="number"] {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

/* Remove spinner controls from all number inputs */
    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    
    input[type="number"] {
        -moz-appearance: textfield;
    }

/* Smaller input fields for loan amount and term */
#loanAmount,
#loanTerm {
    width: 50%;
    max-width: 200px;
}

.term-wrapper input {
    width: 50%;
    max-width: 150px;
}

input[type="number"]:focus,
.currency-select:focus {
    outline: none;
    border-color: #3467a7;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 103, 167, 0.1);
}

.term-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.term-input-group input {
    flex: 2;
    width: 50%;
    max-width: 120px;
}

.term-input-group select {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 120px;
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.term-input-group select:focus {
    outline: none;
    border-color: #007bff;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.calculate-btn,
.reset-btn {
    flex: 1;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calculate-btn {
    background: linear-gradient(135deg, #3467a7 0%, #22c55e 100%);
    color: white;
}

.reset-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.calculate-btn:hover,
.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(52, 103, 167, 0.3);
}

.reset-btn:hover {
    box-shadow: 0 10px 30px rgba(108, 117, 125, 0.3);
}

.calculate-btn:active,
.reset-btn:active {
    transform: translateY(0);
}

/* Results Panel */
.results-panel {
    background: #ffffff;
    color: #333;
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transform: translateX(100px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    height: fit-content;
    position: relative;
    overflow: hidden;
}

.results-panel::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.8s ease;
}

.results-panel.show {
    transform: translateX(0);
    opacity: 1;
}

.results-panel.show::before {
    left: 100%;
}

.results-panel h3 {
    font-size: 1.6rem;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
    color: #2c3e50;
    text-shadow: none;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    margin: 10px 0;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    font-size: 1.1rem;
    font-weight: 600;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    transform: translateY(20px);
    opacity: 0;
    animation: slideInUp 0.6s ease forwards;
}

.result-item:nth-child(2) {
    animation-delay: 0.1s;
}

.result-item:nth-child(3) {
    animation-delay: 0.2s;
}

.result-item:nth-child(4) {
    animation-delay: 0.3s;
}

.result-item:hover {
    background: #e9ecef;
    transform: translateY(18px) scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

.result-item:last-child {
    border-bottom: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.label {
    color: #666;
    font-weight: 500;
}

.value {
    font-weight: 800;
    font-size: 1.4rem;
    color: #3467a7;
    text-shadow: none;
    letter-spacing: 0.5px;
    filter: none;
}

.chart-container {
    margin-top: 40px;
    text-align: center;
    min-height: 700px;
    padding: 20px;
}

#loanChart {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

/* Description Section */
.description-section {
    background: white;
    padding: 40px 0;
    margin: 20px 0;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
}

.description-section h2 {
    font-size: 2.2rem;
    color: #2c3e50;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 600;
}

.description-section p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
    margin-bottom: 20px;
    text-align: justify;
}

/* FAQ Section */
.faq-section {
    background: white;
    padding: 60px 0;
    margin: 40px 0;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
}

.faq-section h2 {
    font-size: 2.2rem;
    color: #2c3e50;
    margin-bottom: 40px;
    text-align: center;
    font-weight: 600;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.faq-item {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border-left: 4px solid #3467a7;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.faq-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.faq-item h3 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
}

.faq-item p {
    color: #666;
    line-height: 1.6;
}

/* Visitor Counter Section - Digital Display Style */
.visitor-counter-section {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 50px 0;
    margin: 40px 0;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
}

.visitor-counter-wrapper {
    text-align: center;
}

.visitor-counter-section h2 {
    font-size: 2.2rem;
    color: #00ff41;
    margin-bottom: 40px;
    font-weight: 600;
    text-shadow: 0 0 10px #00ff41;
    font-family: 'Courier New', monospace;
}

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

.counter-item {
    background: #000;
    padding: 25px 20px;
    border-radius: 10px;
    border: 2px solid #333;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 255, 65, 0.1);
}

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

.counter-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 255, 65, 0.3), inset 0 0 30px rgba(0, 255, 65, 0.2);
    border-color: #00ff41;
}

.counter-item:hover::before {
    left: 100%;
}

.counter-number {
    font-size: 3rem;
    font-weight: 700;
    color: #00ff41;
    margin-bottom: 10px;
    text-shadow: 0 0 15px #00ff41, 0 0 30px #00ff41;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    animation: digitalGlow 2s ease-out, countUp 2s ease-out;
    background: linear-gradient(45deg, #00ff41, #00cc33);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.counter-label {
    font-size: 0.9rem;
    color: #00ff41;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px #00ff41;
}

.counter-note {
    color: #00ff41;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 20px;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px #00ff41;
    opacity: 0.8;
}

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

@keyframes digitalGlow {
    0% {
        text-shadow: 0 0 5px #00ff41;
    }
    50% {
        text-shadow: 0 0 20px #00ff41, 0 0 35px #00ff41;
    }
    100% {
        text-shadow: 0 0 15px #00ff41, 0 0 30px #00ff41;
    }
}

@keyframes digitalFlicker {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    padding: 40px 0;
    margin-top: 60px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #bdc3c7;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #22c55e;
}

.footer-info {
    text-align: center;
    color: #bdc3c7;
}

.footer-info p {
    margin-bottom: 10px;
}

.footer-info a {
    color: #22c55e;
    text-decoration: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 15px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

#modal-body h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-weight: 600;
}

#modal-body p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #555;
}

#modal-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

#modal-body li {
    margin-bottom: 8px;
    color: #555;
}

/* Responsive Design */

/* Large screens and desktops */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .calculator-wrapper {
        gap: 60px;
        padding: 50px;
    }
}

/* Tablets and medium screens */
@media (max-width: 1024px) {
    .calculator-wrapper {
        gap: 30px;
        padding: 35px;
    }
    
    .faq-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* Small tablets and large phones */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        padding: 0.8rem 0;
    }
    
    nav {
        gap: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .calculator-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 30px 20px;
    }
    
    .calculator-form h2 {
        font-size: 1.7rem;
        text-align: center;
    }
    
    .input-wrapper {
        flex-direction: column;
    }
    
    .currency-select {
        min-width: auto;
        width: 100%;
    }
    
    .term-input-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .term-input-group input,
    .term-input-group select {
        width: 100%;
        max-width: none;
        flex: none;
    }
    
    .button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .calculate-btn,
    .reset-btn {
        width: 100%;
    }
    
    .results-panel {
        padding: 25px 20px;
    }
    
    .faq-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .faq-item {
        padding: 20px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 30px 20px;
        width: 95%;
        max-height: 90vh;
    }
    
    .description-section,
    .faq-section,
    .visitor-counter-section {
        padding: 50px 0;
    }
    
    .counter-display {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        padding: 0.5rem 0;
    }
    
    .logo-title {
        gap: 10px;
    }
    
    .logo {
        width: 40px;
        height: 40px;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    nav {
        gap: 15px;
    }
    
    nav a {
        font-size: 0.9rem;
    }
    
    .calculator-section {
        padding: 30px 0;
    }
    
    .calculator-wrapper {
        padding: 20px 15px;
        border-radius: 15px;
    }
    
    .calculator-form h2 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    input[type="number"],
     .currency-select,
     .term-wrapper select {
         padding: 10px 12px;
         font-size: 0.95rem;
     }
     
     /* Reset input field sizes on mobile */
     #loanAmount,
     #loanTerm,
     .term-wrapper input {
         width: 100%;
         max-width: none;
     }
    
    .calculate-btn,
    .reset-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .results-panel {
        padding: 20px 15px;
    }
    
    .results-panel h3 {
        font-size: 1.3rem;
    }
    
    .result-item {
        padding: 12px 0;
        font-size: 0.95rem;
    }
    
    .value {
        font-size: 1rem;
    }
    
    .description-section,
    .faq-section,
    .visitor-counter-section {
        padding: 40px 0;
        margin: 20px 0;
    }
    
    .visitor-counter-section h2 {
        font-size: 1.8rem;
    }
    
    .counter-number {
        font-size: 2rem;
    }
    
    .counter-item {
        padding: 25px 15px;
    }
    
    .description-section h2,
    .faq-section h2 {
        font-size: 1.8rem;
    }
    
    .description-section p {
        font-size: 1rem;
        text-align: left;
    }
    
    .faq-item {
        padding: 18px;
    }
    
    .faq-item h3 {
        font-size: 1.1rem;
    }
    
    .faq-item p {
        font-size: 0.95rem;
    }
    
    .modal-content {
        margin: 2% auto;
        padding: 20px 15px;
        width: 98%;
        max-height: 95vh;
    }
    
    #modal-body h2 {
        font-size: 1.5rem;
    }
    
    #modal-body p {
        font-size: 0.95rem;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .container {
        padding: 0 10px;
    }
    
    h1 {
        font-size: 1.2rem;
    }
    
    .calculator-wrapper {
        padding: 15px 10px;
    }
    
    .calculator-form h2 {
        font-size: 1.4rem;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    input[type="number"],
     .currency-select,
     .term-wrapper select {
         padding: 8px 10px;
         font-size: 0.9rem;
     }
     
     /* Reset input field sizes on very small phones */
     #loanAmount,
     #loanTerm,
     .term-wrapper input {
         width: 100%;
         max-width: none;
     }
    
    .calculate-btn,
    .reset-btn {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    
    .results-panel {
        padding: 15px 10px;
    }
    
    .faq-item {
        padding: 15px;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .calculator-section {
        padding: 20px 0;
    }
    
    .description-section,
    .faq-section {
        padding: 30px 0;
        margin: 15px 0;
    }
    
    .modal-content {
        margin: 2% auto;
        max-height: 95vh;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .calculate-btn,
    .reset-btn,
    nav a,
    .footer-links a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    input[type="number"],
    select {
        min-height: 44px;
    }
    
    .faq-item {
        cursor: default;
    }
    
    .faq-item:hover {
        transform: none;
    }
}

/* Loading Animation */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading .calculate-btn {
    background: #ccc;
    cursor: not-allowed;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus Styles for Accessibility */
*:focus {
    outline: 2px solid #3467a7;
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 103, 167, 0.3);
}

/* Print Styles */
@media print {
    header,
    footer,
    .modal {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .calculator-wrapper {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}