:root {
    --sidebar-bg: rgba(255, 255, 255, 0.85);
    --dark-grey: #2c3e50;
    --dark-navy: #1a252f;
    --modal-bg: #2c3e50;
    --text-color: #ecf0f1;
    --accent-color: #3498db;
    --danger-color: #e74c3c;
    --table-header: #34495e;
    --label-color: #95a5a6;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* Sidebar Styling */
#sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 300px;
    background-color: var(--sidebar-bg);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    padding: 15px;
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-section {
    border-bottom: 1px solid #ccc;
    padding-bottom: 15px;
}

.panel-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Info Panel */
#datetime {
    font-size: 1.5rem;
    /* Enlarge */
    font-weight: 800;
    /* Bolder */
    color: var(--dark-navy);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

#coordinates {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.2rem;
    /* Enlarge */
    font-weight: 700;
    /* Bold */
    color: var(--dark-grey);
    line-height: 1.6;
}

/* Icons */
.panel-controls {
    display: flex;
    justify-content: space-between;
    /* Distribute evenly */
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #ccc;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--dark-grey);
    font-size: 1.8rem;
    /* 2x size increase approx */
    cursor: pointer;
    padding: 10px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 8px;
}

.icon-btn:hover {
    color: var(--accent-color);
    background: rgba(52, 152, 219, 0.1);
    transform: scale(1.1);
}

.primary-icon-btn {
    font-size: 1.5rem !important;
    /* Adjust specific icon size inside button */
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.primary-icon-btn:hover {
    background-color: #34495e !important;
    transform: scale(1.1);
}


/* Control Panel */
.control-panel h3,
.layers-panel h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--dark-navy);
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--dark-navy);
}

/* Modal form label override */
.modal-body form label {
    color: #bdc3c7;
}


select {
    width: 100%;
    padding: 8px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
}

button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    margin-bottom: 10px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.primary-btn {
    background-color: var(--dark-navy);
    color: white;
}

.primary-btn:hover {
    background-color: #34495e;
}

.secondary-btn {
    background-color: var(--dark-grey);
    color: white;
}

.secondary-btn:hover {
    background-color: #3d566e;
}

.danger-btn:hover {
    background-color: #c0392b;
}

/* Modal Styling */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--modal-bg);
    color: var(--text-color);
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-content.small-modal {
    max-width: 350px;
    height: auto;
}

.modal-content.large-modal {
    max-width: 800px;
    height: 80vh;
}


.modal-header {
    background-color: var(--dark-navy);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.close-modal {
    color: #ccc;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: white;
}

.modal-body {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.modal-body form input,
.modal-body form textarea,
.modal-body form select {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    box-sizing: border-box;
    background-color: #ecf0f1;
    border: none;
    border-radius: 4px;
    color: #2c3e50;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.action-btn {
    background-color: #7f8c8d;
    color: white;
    padding: 8px;
    font-size: 0.9rem;
}

.action-btn:hover {
    background-color: #95a5a6;
}

.view-link-container {
    text-align: center;
    margin-bottom: 15px;
}

#view-data-link {
    color: #3498db;
    text-decoration: underline;
    cursor: pointer;
}

#view-data-link:hover {
    color: #5dade2;
}

.form-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.save-btn {
    background-color: #27ae60;
    color: white;
    flex: 2;
}

.save-btn:hover {
    background-color: #2ecc71;
}

.cancel-btn {
    background-color: var(--danger-color);
    color: white;
    flex: 1;
}

.cancel-btn:hover {
    background-color: #c0392b;
}

/* Tab Styling */
.tabs {
    display: flex;
    border-bottom: 1px solid #7f8c8d;
    margin-bottom: 15px;
}

.tab-btn {
    background-color: transparent;
    border: none;
    color: #95a5a6;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    border-bottom: 3px solid transparent;
    margin-bottom: 0;
    border-radius: 0;
    width: auto;
}

.tab-btn.active {
    color: white;
    border-bottom-color: #3498db;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.gallery-grid img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid #34495e;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-grid img:hover {
    transform: scale(1.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    color: white;
}

th {
    background-color: var(--table-header);
    text-align: left;
    padding: 8px;
}

td {
    border-bottom: 1px solid #7f8c8d;
    padding: 8px;
}

/* Detail View Styling */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.detail-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 4px;
}

.detail-item.full-width {
    grid-column: span 2;
}

.detail-item label {
    display: block;
    color: var(--label-color);
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.detail-item span,
.detail-item p {
    color: white;
    font-size: 1rem;
    margin: 0;
}

.details-section {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #7f8c8d;
}

.details-section h3 {
    margin-top: 0;
    color: #bdc3c7;
    font-size: 1.1rem;
}

/* Lightbox Styling */
.lightbox {
    position: fixed;
    z-index: 3000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

#lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#lightbox-caption {
    text-align: center;
    color: #ecf0f1;
    margin-top: 10px;
    font-size: 1.1rem;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 3001;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 15px;
    cursor: pointer;
    transition: background 0.3s;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

/* Upload Queue */
.upload-item {
    background: #ecf0f1;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.upload-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--dark-navy);
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: #bdc3c7;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #2ecc71;
    width: 0%;
    transition: width 0.2s;
}

.upload-status {
    font-size: 0.75rem;
    color: #7f8c8d;
    text-align: right;
}

.upload-error {
    background-color: #fab1a0;
}

.upload-error .progress-bar {
    background-color: #e74c3c;
}


/* Sync Status */
.sync-indicator {
    background-color: #f1c40f;
    /* Warning yellow */
    color: #2c3e50;
    padding: 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sync-btn {
    margin-left: auto;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 0.8rem;
}

.sync-btn:hover {
    background: #34495e;
}


/* User Icon Styling */
.user-icon-marker {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Saved Location Marker (Balloon) */
.custom-balloon-container {
    position: relative;
    overflow: visible;
}

.balloon-marker {
    background-color: var(--dark-navy);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    border: 2px solid white;
    z-index: 2;
    position: absolute;
    top: 0;
    left: 0;
}

.balloon-tip {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid var(--dark-navy);
    position: absolute;
    bottom: 0;
    /* Align with bottom of container height (40px) */
    left: 7px;
    /* Center horizontally (30 - 16)/2 = 7 */
    z-index: 1;
    /* Adjust based on iconHeight 40px, circle 30px. 
       Circle is top 0. Tip needs to descend from it. 
       Circle ends at 30px. Tip should start around 28px.
    */
    top: 28px;
}

/* Hover effect for marker */
.custom-balloon-container:hover .balloon-marker {
    background-color: var(--accent-color);
    border-color: var(--dark-navy);
    transform: scale(1.1);
    transition: all 0.2s;
}

.custom-balloon-container:hover .balloon-tip {
    border-top-color: var(--accent-color);
}

/* Has Photo Coloring */
.balloon-marker.has-photo {
    background-color: #27ae60;
}

.balloon-tip.has-photo {
    border-top-color: #27ae60;
}

/* Saved Location Marker (Hammer) */
.saved-location-marker {
    font-size: 24px;
    color: #f1c40f;
    /* Yellowish Gold */
    text-shadow: 0 0 5px black;
    text-align: center;
    line-height: 24px;
}

/* WMS Layer Control */
.layer-control {
    background: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    position: relative;
}

.layer-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.layer-settings {
    margin-top: 10px;
    padding-left: 5px;
    display: flex;
    flex-direction: column;
}

.layer-order-btns {
    margin-left: auto;
    display: flex;
    gap: 5px;
}

.order-btn {
    background: transparent;
    color: var(--dark-navy);
    border: 1px solid #bdc3c7;
    padding: 2px 8px;
    font-size: 0.9rem;
    width: auto;
    margin-bottom: 0;
    border-radius: 4px;
    cursor: pointer;
}

/* Activity Log */
.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    color: var(--dark-navy);
}

.activity-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 8px;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    font-size: 0.75rem;
    color: #95a5a6;
    min-width: 40px;
}

.activity-text {
    font-weight: 500;
}

.order-btn:hover {
    background: #e0e0e0;
}

.hidden {
    display: none !important;
}