/* =========================================
   0. GLOBAL STYLES & VARIABLES
   ========================================= */

:root {
    /* Colors */
    --background-1: #FAF8F2;
    --text-primary: #222;
    --text-secondary: #343a40;
    --border-color: #dee2e6;
    --border-color-light: #ced4da;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --white: #fff;
    --blue: #0d6efd;
    --red: #dc3545;
    --green: #198754;

    /* Fonts */
    --font-primary: 'Poppins', sans-serif;
}

html,
body {
    height: 100%;
    overflow: hidden;
    /* Prevents scrolling on the main page container */
}

body {
    display: flex;
    flex-direction: column;
    font-family: var(--font-primary);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-1);
}


/* =========================================
   1. TYPOGRAPHY
   ========================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.2;
    color: var(--text-secondary);
}

/* Main page title */
h1 {
    font-size: 3.2rem;
    font-weight: 800;
    /* ExtraBold */
    letter-spacing: -0.02em;
}

/* Major section titles */
h2 {
    font-size: 2.25rem;
    font-weight: 700;
    /* Bold */
}

/* Sub-section titles */
h3 {
    font-size: 1.75rem;
    font-weight: 600;
    /* SemiBold */
}

/* Smaller labels or group titles */
h4 {
    font-size: 1.25rem;
    font-weight: 600;
    /* SemiBold */
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Minor details */
h5,
h6 {
    font-size: 1rem;
    font-weight: 500;
    /* Medium */
}

.app-title,
.report-title {
    font-weight: 600;
    /* color: var(--text-secondary); */
    color: #8B4513;
}

.report-title {
    border-bottom: 2px solid var(--border-color-light);
    padding-bottom: 15px;
}

/* Visual Summary Timeline */
.visual-summary {
    border-radius: 6px;
    padding: 16px;
}

.visual-summary p {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    text-align: center;
}

.visual-summary strong {
    color: #2E7D32;
}

/* =========================================
   2. LAYOUT & STRUCTURE
   ========================================= */

.main-content {
    flex-grow: 1;
    display: flex;
    min-height: 0;
    position: relative;
    /* Important for flexbox children scrolling */
}

#map {
    height: calc(100vh - 61px);
    width: 100%;
    flex-grow: 1;
    z-index: 1000;
    position: relative;
}

.leaflet-container img.leaflet-tile {
    max-width: none !important;
    height: auto !important;
}

.control-panel {
    height: calc(100vh - 61px);
    width: 400px;
    /* width: 100%; */
    background-color: var(--background-1);
    padding: 10px 20px;
    overflow-y: auto;
    box-shadow: 2px 0 10px var(--shadow-color);
    border-right: 1px solid var(--border-color);
    box-sizing: border-box;
}

/* Report section uses full viewport height for scrolling */
.report-section {
    overflow-y: auto;
    height: 100vh;
}

/* Offcanvas styles for responsive layout */
.offcanvas-lg.offcanvas-end {
    height: calc(100vh - 61px);
    top: 61px;
}

.offcanvas-body {
    background-color: var(--background-1);
    height: calc(100vh - 61px) !important;
    overflow-y: hidden;
    transition: transform 0.4s ease-in-out;
}


/* =========================================
   3. COMPONENTS
   ========================================= */

/* --- Cards --- */
.card,
.report-card {
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 8px var(--shadow-color);
    border-radius: 0.5rem;
    background-color: var(--white);
    transition: box-shadow 0.3s ease-in-out;
}

.report-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--white);
    border-bottom: 1px solid var(--border-color);
}

/* Header color variations */
.card-header-blue {
    background-color: var(--blue);
}

.card-header-red {
    background-color: var(--red);
}

.card-header-green {
    background-color: var(--green);
}

/* Specific card header style for reports */
.report-card .card-header {
    background-color: #f8f9fa;
    color: #495057;
}

#selected-location-body p {
    margin-bottom: 0.5rem;
}

#selected-location-body strong {
    display: inline-block;
    min-width: 70px;
    /* Aligns text neatly */
}

/* --- Modals --- */
.modal-container {
    display: none;
    position: fixed;
    z-index: 1050;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content-custom {
    background-color: var(--white);
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s;
}

.close-btn {
    float: right;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
}

#modal-body p {
    font-size: 1.2rem;
    margin: 10px 0;
}

/* --- Forms & Inputs --- */
#date-picker,
#report-detailed-description {
    padding: 10px;
    font-size: 1rem;
    border: 1px solid var(--border-color-light);
    border-radius: 6px;
    background-color: var(--white);
}

#hour-picker-input,
#forecast-date {
    caret-color: transparent;
    /* Hide blinking cursor */
}

/* Remove border radius for input group elements */
#hour-picker-input,
#forecast-date,
.input-group-text {
    border-radius: 0;
}

.form-control:disabled {
    background-color: #f8f9fa;
}

#report-detailed-description {
    min-height: 150px;
    resize: vertical;
    line-height: 1.6;
}

#report-detailed-description:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Placeholder styling for contenteditable div */
#report-detailed-description:empty:before {
    content: attr(aria-placeholder);
    color: #6c757d;
    pointer-events: none;
}

/* --- Search Suggestions --- */
.suggestions-container {
    position: absolute;
    background: var(--white);
    width: calc(100% - 42px);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1100;
    border: 1px solid #ddd;
    border-radius: 0 0 5px 5px;
    font-size: 14px;
}

/* --- Buttons --- */
#scrollTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    background-color: #0dcaf0;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s;
}

#scrollTopBtn:hover {
    background-color: #0b9fb5;
}

/* Floating button for mobile to open the control panel */
/* .open-panel-btn {
    position: absolute;
    top: 70px;
    left: 10px; 
    z-index: 1050;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
} */

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
    vertical-align: middle;
}

#predict-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* --- Pickers Overlay --- */
#pickers-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 0.375rem;
    transition: opacity 0.3s ease;
}

#picker-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    padding: 1rem;
    color: #6c757d;
}

.overlay-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--red);
}

/* --- Streaming Text Effect --- */
.streaming::after {
    content: '▋';
    /* Solid block character */
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}


/* =========================================
   4. ANIMATIONS & KEYFRAMES
   ========================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}


/* =========================================
   5. RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================= */

/* Large devices (desktops, less than 992px) */
@media (max-width: 991.98px) {
    .control-panel {
        box-shadow: none;
        border: none;

        width: 100%;
        /* max-width: 350px; */
        /* padding-left: */
    }

    /* Hide the Bootstrap offcanvas header on desktop where it's not needed */
    #controlPanel .offcanvas-header {
        display: none;
    }

    /* MOBILE PANEL BUTTON */
    .mobile-panel-handle {
        position: absolute;
        /* Position relative to the .offcanvas parent */

        /* Vertically center the button */
        top: 50%;

        /* Anchor it to the RIGHT edge of the .main-content container */
        right: 0;
        transform: translateY(-50%);

        /* Visual Styling */
        width: 35px;
        height: 60px;
        background-color: #0d6efd;
        /* Bootstrap primary blue */
        color: white;
        border: none;
        border-radius: 8px 0 0 8px;
        /* Round the corners on the left */
        font-size: 24px;
        font-weight: bold;
        cursor: pointer;
        z-index: 1001;
        /* Must be higher than the offcanvas backdrop */

        /* Flexbox to perfectly center the < or > symbol */
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        /* Remove any default padding */

        box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.2);
        transition: transform 0.3s ease-in-out;


        /* border: red solid 1px !important; */
    }

    .mobile-panel-handle:hover {
        background-color: #0b5ed7;
        /* Darker blue on hover */
    }
}

/* Medium devices (tablets, less than 768px) */
@media (max-width: 767.98px) {
    .report-title {
        font-size: 1.8rem;
    }

    .report-card .card-body {
        padding: 1rem;
    }

    .report-card .card-body p {
        font-size: 0.95rem;
    }
}

/* Small devices (phones, less than 576px) */
@media (max-width: 575.98px) {

    .card-header strong {
        font-size: 1rem;
    }

    #generate-report-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Stack action buttons on mobile */
    .action-buttons-container .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .action-buttons-container .btn:last-child {
        margin-bottom: 0;
    }


}

/* Small devices (phones, less than 576px) */
@media (max-width: 450px) {
       #controlPanel {
        width: calc(100% - 60px);
    }

    .control-panel{
        padding-bottom: 60px !important;
    }

}

