/* General styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

/* Apply transitions only to specific properties */
body, header, nav a, #toggle-mode, .left-panel, .right-panel, .multiple-panel, .weather-box, .metar-box {
    transition: background-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

/* Exclude text from transitions */
h1, h2, h3, p, pre, label, select, button {
    transition: none;
}

/* Light Mode Colors */
:root {
    --background: #f4f4f4;
    --primary: #2a2a72;
    --secondary: #009ffd;
    --text: #333;
    --card: #ffffff;
}

/* Dark Mode Colors */
.dark-mode {
    --background: #121212;
    --primary: #ff4081;
    --secondary: #8c9eff;
    --text: #e0e0e0;
    --card: #1e1e1e;
}

/* Body styling */
body {
    background-color: var(--background);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Main container */
.container {
    width: 90%;
    max-width: 1200px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(45deg, var(--primary), var(--secondary), #000);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--secondary);
}

/* Navigation menu */
nav {
    display: flex;
    gap: 20px;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.3s ease-in-out;
}

nav a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Toggle button (Dark Mode) */
#toggle-mode {
    background: var(--secondary);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    color: white;
    font-weight: bold;
    font-size: 16px;
    margin-left: 10px; /* Add spacing between nav links and button */
    margin-top: 0px; /* Add margin to lower the button */
}

#toggle-mode:hover {
    background: var(--primary);
}

/* Refresh button */
#refresh-efin {
    background: var(--secondary); /* Revert background color */
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    color: white;
    font-weight: bold;
    font-size: 16px;
    margin-left: 10px; /* Add spacing between nav links and button */
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out; /* Add the same animation as the pop-out buttons */
}

#refresh-efin:hover {
    background: var(--primary);
    color: black; /* Change text color to black on hover */
}

/* Layout */
.content {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

/* Left Panel (Single Mode) */
.left-panel {
    flex: 1;
    background: var(--card);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}

/* Right Panel (Single Mode) */
.right-panel {
    flex: 1;
    background: var(--card);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}

/* Search container */
.search-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Search box */
#search-box {
    flex: 1;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--secondary);
    background: var(--card);
    color: var(--text);
}

/* Find button */
#find-button {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    background: var(--secondary);
    color: white;
    cursor: pointer;
    font-weight: bold;
}

#find-button:hover {
    background: var(--primary);
}

#airport-dropdown {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border-radius: 5px;
    border: 1px solid var(--secondary);
    background: var(--card);
    color: var(--text);
}

/* Info & Weather */
#airport-info,
#weather {
    margin-top: 15px;
    padding: 10px;
    background: var(--background);
    border-radius: 5px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Align METAR & TAF to left */
#weather pre {
    text-align: left;
    white-space: pre-wrap;
    font-family: monospace;
    margin-top: 0; /* Ensure no margin between heading and data */
    margin-bottom: 0; /* Ensure no margin at the bottom */
}

/* Ensure no margin between heading and data */
#weather h3 {
    margin-top: 0; /* Ensure no margin at the top */
    margin-bottom: 0;
}

/* Multiple Page */
.multiple-panel {
    width: 100%;
    background: var(--card);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}

/* Input and Button (Multiple Mode) */
#metar-input {
    width: calc(100% - 80px);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--secondary);
    background: var(--card);
    color: var(--text);
}

#add-metar {
    width: 70px;
    padding: 10px;
    border-radius: 5px;
    border: none;
    background: var(--secondary);
    color: white;
    cursor: pointer;
    font-weight: bold;
}

#add-metar:hover {
    background: var(--primary);
}

/* Clear All Button (Multiple Mode) */
#clear-all {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border-radius: 5px;
    border: none;
    background: #ff4081;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

#clear-all:hover {
    background: #e91e63;
}

/* Include TAF Checkbox (Multiple Mode) */
.toggle-taf-label {
    display: flex;
    align-items: center;
    margin-top: 10px;
    font-weight: bold;
    color: var(--text);
}

#toggle-taf {
    margin-right: 10px;
    transform: scale(1.5);
}

/* METAR Box (Multiple Mode) */
.metar-box {
    margin-top: 15px;
    padding: 15px;
    padding-bottom: 40px; /* Add padding to the bottom to create space for the button */
    background: var(--background);
    border-radius: 8px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    position: relative; /* Ensure the parent element is relative */
}

.metar-box h3 {
    margin-bottom: 10px;
}

.metar-box pre {
    text-align: left;
    white-space: pre-wrap;
    font-family: monospace;
    word-break: break-word;
    overflow-wrap: break-word;
    margin-bottom: 0; /* Ensure no margin at the bottom */
}

/* Remove Button (Multiple Mode) */
.remove-metar {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4081;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.3s ease-in-out;
}

.remove-metar:hover {
    background: #e91e63;
}

/* EFIN Page */
.efin-panel {
    width: 100%;
    background: var(--card);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}

/* Grid layout for METAR boxes */
#efin-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

/* Compact METAR Box */
.metar-box.compact {
    margin-top: 15px;
    padding: 15px;
    padding-bottom: 25px; /* Add padding to the bottom to create space for the button */
    background: var(--background);
    border-radius: 8px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    position: relative; /* Ensure the parent element is relative */
}

.metar-box.compact h3 {
    margin-bottom: 5px;
    font-size: 16px;
}

.metar-box.compact pre {
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Pop Out button */
.pop-out-button {
    background: var(--secondary);
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.3s ease-in-out;
    z-index: 1;
    position: absolute; /* Position the button absolutely */
    bottom: 10px; /* Position 10px from the bottom */
    right: 10px; /* Position 10px from the right */
}

.pop-out-button:hover {
    background: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
    .content {
        flex-direction: column;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    nav {
        margin-top: 10px;
    }

    #toggle-mode, #refresh-efin {
        margin-top: 10px;
    }
}

/* Position Leaflet zoom buttons to bottom left */
.leaflet-control-zoom {
    bottom: 10px !important;
    top: auto !important;
    left: 10px !important;
    right: auto !important;
}