:root {
    --primary-color: #007398;
    --background-color: #f5f5f5;
    --padding: 20px;
    --text-color: #fff;
    --border-radius: 5px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
}

html, body {
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    width: 100vw;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    background-image: url(images/bgimage.jpg);
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;   
}

.left-logo {
    height: 140px;
    width: auto;
    object-fit: contain;
}

nav {
    text-align: center;
    margin: 10px 0;
}

nav a {
    text-decoration: none;
    margin: 0 10px;
    color: #333333;
    font-weight: 500;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--primary-color);
    color: var(--text-color);
    padding: var(--padding);
    gap: 10px;
}

header img {
    height: 140px;
    width: auto;
    flex-shrink: 0;
}

header h1 {
    font-size: 40px;
    margin: 0;
    flex: 1;
    text-align: center;
    white-space: nowrap;
}

.controls {
    flex-shrink: 0;
    display: flex;
}

.title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    text-align: center;
}

.title-container h1 {
    font-size: 40px;
    margin: 0;
}

.title-container h4 {
    font-size: 14px;
    font-weight: normal;
    margin-top: 5px;
    line-height: 1.4;
}

/* ✅ FIXED MAIN ALIGNMENT */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;   /* 👈 important fix */
    padding: var(--padding);
}

/* ✅ HEADINGS LEFT */
main h2 {
    margin-left: 15%;
    margin-right: 15%;
}

/* FORM */
main form {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
    gap: 10px;
}

form input[type="text"],
form button[type="submit"],
form button[type="reset"] {
    font-size: 16px;
    font-weight: 500;
    border-radius: var(--border-radius);
    padding: 10px;
    border: none;
    width: 30%;
    box-shadow: 0px 0px 1px;
}

form input[type="text"] {
    flex-grow: 1;
    min-width: 200px;
    max-width: 400px;
    width: 100%;
}

form button[type="submit"] {
    background-color: var(--primary-color);
    color: var(--text-color);
    cursor: pointer;
    flex-shrink: 0;
}

form button[type="reset"] {
    background-color: #5c5c5c;
    color: var(--text-color);
    flex-shrink: 0;
}

.result {
    background-color: #fff;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 800px;
    margin: 35px auto 2%;
    padding: 10px 15px;
    border-radius: var(--border-radius);
}

#letter-buttons button {
    margin: 2px;
    padding: 5px 10px;
    box-shadow: 2px 2px 2px;
    border: #1f1f1f;
    border-radius: 20%;
}

main p a {
    text-decoration: none;
    color: #000000;
}

.browse-section {
    margin-top: 0%;
}

.browse {
    margin-top: 90px;
    text-align: center;
}

.browse-results {
    background-color: #fff;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 700px;
    margin: 35px auto;
    padding: 15px 15px 0 40px;
    border-radius: var(--border-radius);
    overflow-y: auto;
    max-height: 300px;
    transition: max-height 0.3s ease;
}

.home-content {
    margin-left: 12%;
    margin-right: 12%;
    font-size: large;
    text-align: justify;
}


.about-us {
    font-size: larger;
    text-align: justify;
    margin-left: 15%;
    margin-right: 15%;
}


.about-points {
    margin-left: 15%;
    margin-right: 15%;
    text-align: left;
    font-size: larger;
    align-self: flex-start;
}

.contact{
    text-align: center;
    font-size: larger;
}

footer {
    background-color: var(--primary-color);
    color: var(--text-color);
    padding: var(--padding);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 10px;
}

.social-icons {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
}

footer p {
    margin: 0;
    text-align: center;
    flex: 1;
}

footer a {
    text-decoration: none;
    color: #fff;
}

/* DARK MODE */
body.dark-mode {
    --background-color: #1f1f1f;
    --primary-color: #007398;
    --text-color: #ffffff;
    color: var(--text-color);
}

.dark-mode-icon {
    width: 24px;
    height: 24px;
}

#dark-mode-toggle {
    width: 60px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border-radius: 30px;
    border: none;
    cursor: pointer;
}

#dark-mode-toggle img {
    width: 20px;
    height: 20px;
}

body.dark-mode #dark-mode-toggle {
    background-color: #252525;
}

body.dark-mode a {
    color: #90caf9 !important;
}

body.dark-mode nav a {
    color: #dcdcdc;
}

body.dark-mode .result,
body.dark-mode .browse-results {
    background-color: #2c2c2c;
    color: #f5f5f5;
}

body.dark-mode form button[type="reset"] {
    background-color: #555;
}

/* RIGHT SECTION */
.right-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
}

/* TABLET */
@media (max-width: 768px) {
    header {
        flex-wrap: wrap;
        justify-content: center;
    }

    .logo {
        height: 70px;
    }

    .title-container {
        order: 3;
        width: 100%;
        margin-top: 10px;
    }
}

/* MOBILE */
@media (max-width: 480px) {
    header {
        flex-direction: column;
    }

    .logo {
        height: 50px;
    }

    .title-container h1 {
        font-size: 18px;
    }

    form {
        flex-direction: column;
        align-items: center;
    }

    form input {
        width: 90%;
    }

    form button {
        width: 60%;
    }

    footer {
        flex-direction: column;
        gap: 10px;
    }
}