* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #fff;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(160, 118, 177, 0.3);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo-img {
    height: 80px;
    width: auto;
    filter: drop-shadow(0 0 20px rgba(160, 118, 177, 0.6));
    transition: all 0.3s ease;
}

.logo:hover .logo-img {
    filter: drop-shadow(0 0 25px rgba(160, 118, 177, 1));
    transform: scale(1.05);
}

main {
    margin-top: 100px;
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.content-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
    margin-bottom: 3rem;
}

.content-section {
    background: rgba(26, 26, 46, 0.7);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    padding: 2.5rem;
    border: 1px solid rgba(160, 118, 177, 0.2);
    transition: all 0.4s ease;
}

.content-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(160, 118, 177, 0.3);
    border-color: rgba(160, 118, 177, 0.5);
    background: rgba(26, 26, 46, 0.9);
}

.content-section h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #f8fafc;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.sensors-section {
    margin-bottom: 2rem;
}

.sensors-section h2 {
    font-size: 1.8rem;
    color: #A076B1;
    margin-bottom: 1rem;
}

.sensors-list {
    list-style: none;
    margin-bottom: 2rem;
}

.sensors-list li {
    color: #cbd5e1;
    margin-bottom: 0.8rem;
    padding: 0.8rem;
    background: rgba(160, 118, 177, 0.1);
    border-radius: 8px;
    border-left: 4px solid #A076B1;
    font-size: 1rem;
}

.sensors-list li strong {
    color: #f8fafc;
}

.description {
    font-size: 1.1rem;
    color: #e2e8f0;
    line-height: 1.7;
    text-align: justify;
    margin-bottom: 2rem;
}

/* Mission Planning Section */
.mission-info {
    background: rgba(22, 33, 62, 0.6);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(160, 118, 177, 0.2);
}

.mission-info h3 {
    font-size: 1.4rem;
    color: #A076B1;
    margin-bottom: 1rem;
    text-align: center;
}

.area-display, .polygon-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding: 0.5rem;
    background: rgba(160, 118, 177, 0.1);
    border-radius: 6px;
}

.area-display:last-child, .polygon-count:last-child {
    margin-bottom: 0;
}

/* Map Section */
.map-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.map-controls {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.dropdown-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dropdown-container label {
    color: #A076B1;
    font-weight: 500;
    font-size: 1rem;
}

.dropdown {
    padding: 0.8rem 1rem;
    border: 2px solid rgba(160, 118, 177, 0.3);
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.8);
    color: #e2e8f0;
    font-size: 1rem;
    min-width: 150px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.dropdown:focus {
    outline: none;
    border-color: #A076B1;
    box-shadow: 0 0 0 3px rgba(160, 118, 177, 0.2);
}

.dropdown:hover {
    border-color: rgba(160, 118, 177, 0.5);
}

.dropdown option {
    background: rgba(26, 26, 46, 0.95);
    color: #e2e8f0;
    padding: 0.5rem;
}

/* Export Controls */
.export-controls {
    display: flex;
    gap: 1rem;
}

.export-button {
    padding: 0.8rem 1.2rem;
    border: 2px solid rgba(160, 118, 177, 0.3);
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.8);
    color: #e2e8f0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.export-button:hover {
    border-color: #A076B1;
    background: rgba(160, 118, 177, 0.2);
    transform: translateY(-1px);
}

/* Map Overlay Controls */
.map-overlay-controls {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.map-overlay-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.95);
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(160, 118, 177, 0.3);
}

.map-overlay-btn:hover {
    background: rgba(160, 118, 177, 0.2);
    border-color: #A076B1;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(160, 118, 177, 0.4);
}

.map-overlay-btn.active {
    background: #A076B1;
    color: white;
    border-color: #A076B1;
}

.map-overlay-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #fca5a5;
}

/* Drawing Controls */
.drawing-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}


/* Map Container */
.map-container {
    background: rgba(26, 26, 46, 0.7);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    border: 1px solid rgba(160, 118, 177, 0.2);
    overflow: hidden;
    height: 600px;
    transition: all 0.4s ease;
}

.map-container:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(160, 118, 177, 0.3);
    border-color: rgba(160, 118, 177, 0.5);
}

#map {
    width: 100%;
    height: 100%;
    border-radius: 15px;
    pointer-events: auto; /* Ensure mouse events work */
}

/* Polygon List */
.polygon-list {
    background: rgba(26, 26, 46, 0.7);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid rgba(160, 118, 177, 0.2);
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.polygon-list h4 {
    color: #A076B1;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.2rem;
}

.polygon-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    background: rgba(160, 118, 177, 0.1);
    border-radius: 8px;
    border-left: 3px solid #A076B1;
    transition: all 0.3s ease;
}

.polygon-item:hover {
    background: rgba(160, 118, 177, 0.2);
    transform: translateX(3px);
}

.polygon-item:last-child {
    margin-bottom: 0;
}

.polygon-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.polygon-info strong {
    color: #f8fafc;
    font-size: 0.95rem;
}

.area-text {
    color: #cbd5e1;
    font-size: 0.85rem;
}

.polygon-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(160, 118, 177, 0.2);
    transform: scale(1.1);
}

.action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Back Button */
.back-button {
    display: inline-block;
    background: linear-gradient(135deg, #A076B1 0%, #8A65A0 100%);
    color: white;
    padding: 0.8rem 1.8rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 2rem;
    box-shadow: 0 8px 25px rgba(160, 118, 177, 0.3);
}

.back-button:hover {
    background: linear-gradient(135deg, #8A65A0 0%, #7A5B8E 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(160, 118, 177, 0.5);
}

.back-button-container {
    text-align: center;
    margin-top: 3rem;
}

/* Footer */
footer {
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(20px);
    color: #cbd5e1;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
    border-top: 1px solid rgba(160, 118, 177, 0.3);
}

/* Custom Scrollbar */
.polygon-list::-webkit-scrollbar {
    width: 6px;
}

.polygon-list::-webkit-scrollbar-track {
    background: rgba(160, 118, 177, 0.1);
    border-radius: 3px;
}

.polygon-list::-webkit-scrollbar-thumb {
    background: rgba(160, 118, 177, 0.5);
    border-radius: 3px;
}

.polygon-list::-webkit-scrollbar-thumb:hover {
    background: #A076B1;
}

/* Responsive design */
@media (max-width: 768px) {
    .content-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .content-section {
        padding: 2rem;
    }

    .content-section h1 {
        font-size: 2rem;
    }

    .sensors-section h2 {
        font-size: 1.5rem;
    }

    .map-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .export-controls {
        justify-content: center;
    }

    .export-button {
        min-width: auto;
        flex: 1;
        max-width: 150px;
    }

    .dropdown {
        min-width: auto;
        width: 100%;
    }

    .map-container {
        background: rgba(26, 26, 46, 0.7);
        backdrop-filter: blur(20px);
        border-radius: 15px;
        border: 1px solid rgba(160, 118, 177, 0.2);
        overflow: hidden;
        height: 600px;
        transition: all 0.4s ease;
        pointer-events: auto; /* Ensure container allows mouse events */
    }

    .map-overlay-controls {
        left: 5px;
    }

    .map-overlay-btn {
        width: 45px;
        height: 45px;
    }

    .polygon-list {
        max-height: 200px;
    }

    .logo-img {
        height: 45px;
    }

    .mission-info {
        padding: 1rem;
    }

    .area-display, .polygon-count {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .content-section {
        padding: 1.5rem;
    }

    .content-section h1 {
        font-size: 1.8rem;
    }

    .export-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .export-button {
        max-width: none;
        width: 100%;
    }

    .map-container {
        height: 300px;
    }

    .map-overlay-controls {
        left: 3px;
    }

    .map-overlay-btn {
        width: 40px;
        height: 40px;
    }

    .polygon-list {
        max-height: 150px;
        padding: 1rem;
    }

    .polygon-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .polygon-actions {
        align-self: flex-end;
    }

    .logo-img {
        height: 40px;
    }

    .mission-info h3 {
        font-size: 1.2rem;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-section {
    animation: fadeInUp 1s ease;
}

.map-container {
    animation: fadeInUp 1s ease 0.2s both;
}

.polygon-list {
    animation: fadeInUp 1s ease 0.4s both;
}

/* Utility classes */
.hidden {
    display: none;
}

.fade-in {
    animation: fadeInUp 0.5s ease forwards;
}