* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

#map {
    width: 100%;
    height: 100%;
}

/* Sidebar styles */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 300px;
    height: 100%;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    z-index: 1000;
    padding: 20px;
}

#sidebar h2 {
    margin-top: 0;
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

#pin-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#pin-list li {
    padding: 12px;
    margin-bottom: 8px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}

#pin-list li:hover {
    background-color: #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#pin-list li.active {
    border-color: #0d6efd;
    background-color: #e7f1ff;
}

#pin-list .pin-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

#pin-list .pin-description {
    font-size: 0.875rem;
    color: #666;
    margin: 0;
}

/* Map container with sidebar offset */
#map-container {
    height: 100%;
    margin-left: 300px;
}

/* Admin panel styles */
#admin-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background-color: #fff;
    border-left: 1px solid #dee2e6;
    overflow-y: auto;
    z-index: 1000;
    padding: 20px;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
}

#admin-panel h2 {
    margin-top: 0;
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

#admin-panel h3 {
    color: #555;
    font-size: 1.1rem;
    margin-top: 30px;
    margin-bottom: 15px;
}

/* Login form styles */
#login-form {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

#login-form .form-group {
    margin-bottom: 15px;
}

#login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

#login-form input[type="text"],
#login-form input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
}

#login-form button {
    width: 100%;
    padding: 10px;
    background-color: #0d6efd;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

#login-form button:hover {
    background-color: #0b5ed7;
}

/* Pin form styles */
#pin-form {
    display: none;
}

#pin-form.visible {
    display: block;
}

#pin-form .form-group {
    margin-bottom: 15px;
}

#pin-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

#pin-form input[type="text"],
#pin-form input[type="url"],
#pin-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

#pin-form textarea {
    min-height: 80px;
    resize: vertical;
}

#pin-form button[type="submit"] {
    width: 100%;
    padding: 10px;
    background-color: #198754;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

#pin-form button[type="submit"]:hover {
    background-color: #157347;
}

#pin-form button[type="button"] {
    width: 100%;
    padding: 10px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}

#pin-form button[type="button"]:hover {
    background-color: #5c636a;
}

/* Pins table styles */
#pins-table-container {
    display: none;
}

#pins-table-container.visible {
    display: block;
}

#pins-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

#pins-table th,
#pins-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

#pins-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
}

#pins-table tr:hover td {
    background-color: #f8f9fa;
}

#pins-table .actions {
    display: flex;
    gap: 5px;
}

#pins-table .actions button {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
}

#pins-table .actions .edit-btn {
    background-color: #0d6efd;
    color: white;
}

#pins-table .actions .delete-btn {
    background-color: #dc3545;
    color: white;
}

/* Logout button */
#logout-btn {
    width: 100%;
    padding: 10px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 20px;
}

#logout-btn:hover {
    background-color: #bb2d3b;
}

/* Iframe popup styles */
#iframe-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 900px;
    height: 70%;
    max-height: 700px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 2000;
}

#iframe-popup.visible {
    display: block;
}

#iframe-popup .popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
}

#iframe-popup .popup-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

#iframe-popup .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

#iframe-popup .close-btn:hover {
    color: #333;
}

#iframe-popup iframe {
    width: 100%;
    height: calc(100% - 50px);
    border: none;
    border-radius: 0 0 8px 8px;
}

/* Popup overlay */
#popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1999;
}

#popup-overlay.visible {
    display: block;
}

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
    border-radius: 6px;
}

.leaflet-popup-content {
    margin: 12px 15px;
    font-family: inherit;
}

.leaflet-popup-content h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: #333;
}

.leaflet-popup-content p {
    margin: 0 0 8px 0;
    font-size: 0.875rem;
    color: #666;
}

.leaflet-popup-content a {
    color: #0d6efd;
    text-decoration: none;
}

.leaflet-popup-content a:hover {
    text-decoration: underline;
}

/* Custom marker styles */
.custom-marker {
    background-color: #dc3545;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Status message */
.status-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.875rem;
}

.status-message.success {
    background-color: #d1e7dd;
    color: #155724;
    border: 1px solid #badbcc;
}

.status-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c2c7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    #map-container {
        margin-left: 0;
    }
    
    #admin-panel {
        width: 100%;
    }
    
    #iframe-popup {
        width: 95%;
        height: 80%;
    }
}