
@import url('https://fonts.googleapis.com/css2?family=Condiment&family=Ephesis&family=Griffy&family=Meow+Script&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Potta+One&family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&display=swap');

/* Basic Laypout */
body {
    font-family: 'Source Serif 4', sans-serif;
    background: rgb(42, 119, 83);
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.3s ease;
}

nav {
    padding: 10px 30px;
    margin-bottom: 50px;
    background: rgb(107, 192, 152);
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 50px;
    align-items: center;
    margin-top: 0;
    top: 0;
    left: 0;
}

nav ul {
    list-style: none;
    text-decoration: rgb(208, 248, 226) wavy underline;
    flex-direction: row;
    display: flex;
    gap: 50px;
    justify-content: space-evenly;
    align-items: center;
    font-size: 1.5rem;
    font-style: italic;
}

nav a {
    text-decoration: none;
    color: rgb(3, 107, 73);
}

main {
    flex: 1;
}

h2 {
    text-align: center;
    font-size: 1.5rem;
    color: rgb(168, 212, 168);
    text-decoration: rgb(185, 185, 153) wavy underline;
}

body.dark h2 {
    color: beige;
    text-decoration: beige wavy underline;
}

p {
    text-align: center;
    font-size: 1.13rem;
    font-style: italic;
    color: rgb(194, 243, 194);
}

.container {
    background: #77cfa6;
    border-radius: 0;
    padding: 2rem 3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 85%;
    max-width: 500px;
    align-items: center;
    margin-top: 70px;
}

h1 {
    text-align: center;
    margin-bottom: 1rem;
    color: #184945;
    font-weight: 900;
    font-style: italic;
    text-decoration: underline;

}

/* Form Styling */
form label {
    font-weight: 600;
    display: inline-block;
    margin-bottom: 0.3rem;
    color: #222;
}

form input {
    width: 70%;
    padding: 10px;
    margin-bottom: 1rem;
    border: 1px solid #0d7570;
    border-radius: 19px;
    outline: none;
    background: rgb(223, 248, 246);
    font-size: 1rem;
    color: rgb(109, 80, 25);
    font-family: 'Source Serif 4', sans-serif;
    transition: all 0.3s ease;
}

form input:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
}

button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    margin: 1.5rem 0.25rem;
    border: groove;
    align-items: center;
    border-radius: 12px;
    font-weight: bold;
    font-family: 'Source Serif 4', sans-serif;
    cursor: pointer;
    width: 50%;
    transition: background 0.3s ease, color 0.3s ease;
}

#loanForm button[type="submit"] {
    background-color: #235252;
    color: white;
    font-size: 1rem;
}

#loanForm button[type="submit"]:hover {
    background-color: #41c9ab;
    color: rgb(33, 105, 96);
    font-size: 1rem;
}

#calculateBtn {
    background-color: #2e6e64;
    color: white;
}

#resetBtn {
    background-color: #319b7f86;
    color: white;
    display: block;
    font-size: 1rem;
}

#calculateBtn:hover {
    background-color: #00b3aa;
}

#resetBtn:hover {
    background-color: #7ccece;
}

/* Results */
.loan-result {
    background-color: #b3e5ee;
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    border-bottom: inset 0 0 8px rgba(0, 0, 0, 0.05);
    font-size: 1rem;
    color: #222;
}

.loan-result p {
    margin: 0.75rem 0;
    font-size: 1rem;
    color: #222;
}

.summary-box {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px dashed #ccc;
    border-radius: 10px;
    background: #e9f5ff;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Extra Features*/
.tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
    color: #007bff;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.error {
    color: #dc3545;
    font-weight: 500;
    padding-top: 0.5rem;
}

/* Loan History*/
.loan-history{
    background-color: rgba(180, 235, 235, 0.467);
    padding: 1rem;
    margin-top: 1.5rem;
    border-radius: 10px;
    border-left: 5px solid #17b8a3;
    animation: fadeIn 0.5s ease-in-out;
}

.loan-history h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: #0d5b69;
}

.loan-history ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.loan-history .date {
    font-weight: bold;
    font-size: 1.2rem;
    color: #555;
}

.loan-history .value {
    font-size: 1.2rem;
}

.history-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.history-actions button {
    background-color: #478d7b;
    color: #fff;
}

.history-actions button:hover {
    background-color: #3d9096;
}

/* Dark Mode */
body.dark {
    background: darkslategray;
    color: #f5f5f5;
}

body.dark .container {
    background-color: #3a4d4a;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

body.dark form label,
body.dark .loan-result p,
body.dark .loan-history li,
body.dark h3 {
    color: #f5f5f5;
    text-align: center;
}

body.dark form input {
    background-color: #1e1e2f;
    border: 1px solid #555;
    color: #fff;
}

body.dark .loan-result {
    background-color: #3a3b4d;
    box-shadow: none;
}

body.dark .error {
    color: #ff6b6b;
}

body.dark .tooltip {
    color: #ffc107;
}

body.dark .summary-box {
    background: #2f354a;
    border-color: #444;
    color: #e5e5e5;
}

body.dark .error {
    color: #ff6b6b;
}

/* Toggle Button */
#themeToggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: #afe2ca;
    color: #0e503c;
    border-radius: 0;
    font-family: 'Source Serif 4', sans-serif;
    padding: 0.8rem 0.8rem;
    border-radius: 0rem;
    width: 21%;
    font-size: 1rem;
    margin-top: 130px;
    margin-bottom: 70px;

}

body.dark #themeToggle {
    background-color: #517566;
    color: #fff;
}

.loan-result, .summary-box {
    animation: fadeInUp 0.4s ease-in-out;
}
    
body.dark h1 {
    background: rgb(131, 192, 179);
    text-decoration: underline;
}

/* EMI Chart Styling */
.emi-chart-container {
    margin-top: 1rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    animation: fadeIn 0.5s ease-in-out;
    padding: 1rem;
    border-radius: 12px;
    background: linear-gradient(to right, #e3f2fd, #ffffff);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

/* Chart canvas */
#emiChart {
    display: block;
    max-width: 100%;
    max-height: 300px;
    margin: 2rem auto 1rem auto;
    width: 100%;
    height: auto !important;
    transition: transform 0.4s ease;
    animation: fadeInOut 0.6s ease-in-out;
}

/* On hover, slighty zoom the chart */
#emiChart:hover {
    transform: scale(1.05);
}

/* Light Theme */
body:not(.dark) .emi-chart-container {
    background: linear-gradient(135deg, #f3faff, #ffffff);
}

/* Dark Theme */
body.dark .emi-chart-container {
    background: linear-gradient(135deg, #2a2e3a, #1e2028);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

/* Fade-In animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 500px) {
    #emiChart {
        max-width: 100%;
        height: auto;
    }
}

canvas#emiChart {
    background: transparent;
    padding: 10px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.08);
}

/* Add a heading for context */
.emi-chart-title {
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #333;
}

body.dark .emi-chart-title {
    color: #f0f0f0;
}

/* Chart Type Dropdown Styling */
#chartType {
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border-radius: 15px;
    border: 1px solid #ccc;
    background-color: #d1f5ef;
    color: #125e5e;
    font-size: 1.2rem;
    outline: none;
    transition: all 0.3s ease;
    margin: 0.5rem 0;
    cursor: pointer;
}

#chartType:hover {
    border-color: #007bff;
}

#chartType:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
}

/* Optional: Label styling for consistency */
label[for="chartType"] {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #222;
}

/* Dark Mode Support */
body.dark #chartType {
    background-color: #2d2d3f;
    color: #f5f5f5;
    border: 1px solid #555;
}

body.dark label[for="chartType"] {
    color: #f5f5f5;
}

footer {
    background-color: rgb(87, 170, 114);
    width: 100%;
    padding: 10px 30px;
    font-size: 1.3rem;
    font-style: italic;
    color:rgb(3, 54, 20);
    text-align: center;
    margin-top: 30px;
}