/* ----------------------------
   General Layout
---------------------------- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body.light {
    background: #f8f9fa;
    color: #333;
}

body.dark {
    background: #222;
    color: #f8f9fa;
}

/* ----------------------------
   Header
---------------------------- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: #222;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    z-index: 1000;
}

.app-title {
    font-size: 1.2rem;
    font-weight: bold;
}

.header-actions button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #fff;
    margin-left: 0.5rem;
    cursor: pointer;
}

/* ----------------------------
   Map Container
---------------------------- */
#map-container {
    height: 100vh;
    width: 100%;
    padding-top: 50px; /* space for header */
    box-sizing: border-box;
}

#map {
    height: 100%;
    width: 100%;
}

/* ----------------------------
   Slide-out Settings Menu
---------------------------- */
#settings-menu {
    position: fixed;
    top: 0;
    right: -350px; /* hidden by default */
    width: 300px;
    height: 100%;
    background: #f8f8f8;
    box-shadow: -2px 0 5px rgba(0,0,0,0.3);
    padding: 1rem;
    transition: right 0.3s ease;
    z-index: 1001;
}

#settings-menu.active {
    right: 0; /* slide in */
}

#settings-menu ul {
    list-style: none;
    padding: 0;
}

#settings-menu li {
    margin: 0.8rem 0;
}

#settings-menu button {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    cursor: pointer;
    font-weight: bold;
}



/* ----------------------------
   Auth (Login/Register) Layout
---------------------------- */
.auth-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

.auth-left {
    flex: 0 0 60%;
    background: url('../images/loginscreen.jpg') no-repeat center center;
    background-size: cover;
}

.auth-right {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    background: #f8f9fa; /* matches light theme background */
    box-sizing: border-box;
    overflow-y: auto;
}

.auth-right h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #222;
}

.auth-form {
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
}

.auth-form input {
    margin-bottom: 1rem;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

.auth-form button {
    padding: 0.8rem;
    background: #222;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-form button:hover {
    background: #444;
}

.error {
    color: #c00;
    font-weight: bold;
}
.success {
    color: #090;
    font-weight: bold;
}

/* ----------------------------
   Mobile UI Scaling
---------------------------- */
@media (max-width: 768px) {
    /* Bigger tap targets for header buttons */
    .header-actions button {
        font-size: 2rem;    /* increase icon size */
        padding: 0.8rem;    /* more space around */
    }

    /* Layer control buttons (Leaflet default controls) */
    .leaflet-control {
        transform: scale(1.4);
        transform-origin: top left;
    }

    /* Weather alert + menu icons */
    .weather-alert-icon,
    .menu-icon {
        font-size: 2rem;
        padding: 0.8rem;
    }

    /* General inputs/buttons on forms */
    input, button, select {
        font-size: 1.1rem;
        padding: 0.9rem;
    }

    /* ----- Mobile Login Layout ----- */
    .auth-container {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: relative;
        background: url('../images/loginscreen.jpg') no-repeat center center;
        background-size: cover;
        overflow: hidden;
    }

    /* Add dark overlay behind login box */
    .auth-container::before {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 0;
    }

    .auth-left {
        display: none;
    }

    .auth-right {
        position: relative;
        z-index: 1;
        background: rgba(255, 255, 255, 0.92);
        border-radius: 12px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        padding: 2rem;
        max-width: 350px;
        width: 90%;
        text-align: center;
    }

    .auth-right h2 {
        color: #222;
        margin-bottom: 1.5rem;
    }

    .auth-form {
        width: 100%;
    }

    .auth-form input {
        width: 100%;
        padding: 0.9rem;
        margin-bottom: 1rem;
        border-radius: 6px;
        border: 1px solid #ccc;
        font-size: 1rem;
    }

    .auth-form button {
        width: 100%;
        padding: 0.9rem;
        background: #222;
        color: #fff;
        border: none;
        border-radius: 6px;
        font-size: 1rem;
        cursor: pointer;
        transition: background 0.3s;
    }

    .auth-form button:hover {
        background: #444;
    }
}

/* ----------------------------
   Mobile Responsiveness
---------------------------- */
@media (max-width: 480px) {
    #settings-menu {
        width: 80%;
    }

    .app-title {
        font-size: 1rem;
    }

    input, button {
        font-size: 14px;
    }

    /* ----- Mobile Login Layout ----- */
    .auth-container {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: relative;
        background: url('../images/loginscreen.jpg') no-repeat center center;
        background-size: cover;
        overflow: hidden;
    }

    /* Add dark overlay behind login box */
    .auth-container::before {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 0;
    }

    .auth-left {
        display: none;
    }

    .auth-right {
        position: relative;
        z-index: 1;
        background: rgba(255, 255, 255, 0.92);
        border-radius: 12px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        padding: 2rem;
        max-width: 350px;
        width: 90%;
        text-align: center;
    }

    .auth-right h2 {
        color: #222;
        margin-bottom: 1.5rem;
    }

    .auth-form {
        width: 100%;
    }

    .auth-form input {
        width: 100%;
        padding: 0.9rem;
        margin-bottom: 1rem;
        border-radius: 6px;
        border: 1px solid #ccc;
        font-size: 1rem;
    }

    .auth-form button {
        width: 100%;
        padding: 0.9rem;
        background: #222;
        color: #fff;
        border: none;
        border-radius: 6px;
        font-size: 1rem;
        cursor: pointer;
        transition: background 0.3s;
    }

    .auth-form button:hover {
        background: #444;
    }
}
