/* Common styles shared across all pages */

/* Base reset */
* { box-sizing: border-box; }
html, body {
    height: 100%;
    margin: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 15px;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
}

/* Layout */
.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.header {
    flex-shrink: 0;
}
h1 {
    margin: 0 0 10px;
    color: #333;
    font-size: 1.5rem;
}

/* Panels */
.panel {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.panel h3 {
    margin-top: 0;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}
label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}
input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
input:focus {
    outline: none;
    border-color: #007bff;
}
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}
select:focus {
    outline: none;
    border-color: #007bff;
}

/* Buttons - Base */
button {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}
button:hover {
    background: #0056b3;
}
button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Button variants */
.btn-confirm {
    background: #28a745;
}
.btn-confirm:hover {
    background: #218838;
}
.btn-confirm:disabled {
    background: #ccc;
}

.btn-cancel {
    background: #dc3545;
}
.btn-cancel:hover {
    background: #c82333;
}

.btn-save {
    background: #17a2b8;
}
.btn-save:hover {
    background: #138496;
}
.btn-save:disabled {
    background: #ccc;
}

.btn-draw {
    background: #ff6b00;
}
.btn-draw:hover {
    background: #e55f00;
}
.btn-draw:disabled {
    background: #ccc;
}

.btn-clear, .btn-reset {
    background: #6c757d;
}
.btn-clear:hover, .btn-reset:hover {
    background: #545b62;
}

.btn-export {
    background: #28a745;
}
.btn-export:hover {
    background: #218838;
}
.btn-export:disabled {
    background: #ccc;
}

/* Navigation Menu */
.main-nav {
    display: flex;
    gap: 0;
    margin-bottom: 15px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.main-nav a {
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}
.main-nav a:hover {
    background: #f8f9fa;
    color: #007bff;
}
.main-nav a.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: #f0f7ff;
}

/* Legacy nav-link (kept for backwards compatibility) */
.nav-link {
    display: inline-block;
    margin-bottom: 15px;
    color: #007bff;
    text-decoration: none;
}
.nav-link:hover {
    text-decoration: underline;
}

/* States */
.error {
    background: #fee;
    color: #c00;
    padding: 10px;
    border-radius: 4px;
    margin-top: 15px;
}
.loading {
    color: #666;
    font-style: italic;
}

/* Map */
#map {
    flex: 1;
    min-height: 400px;
    border-radius: 4px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
thead {
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}
th, td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
th {
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    font-size: 11px;
    background: #f8f9fa;
}
tr:hover {
    background: #f8f9fa;
}
tr.selected {
    background: #e3f2fd;
}
tr.clickable {
    cursor: pointer;
}

/* Edit controls panel */
.edit-controls {
    display: none;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 10px;
    border: 1px solid #dee2e6;
}
.edit-controls.active {
    display: block;
}
.edit-controls h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #333;
}
.edit-controls p {
    margin: 0 0 10px;
    font-size: 13px;
    color: #666;
}
.edit-buttons {
    display: flex;
    gap: 8px;
}
.edit-buttons button {
    padding: 8px 16px;
    font-size: 13px;
}

/* Drawing panel */
.drawing-panel {
    flex-shrink: 0;
    margin-top: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}
.drawing-panel h4 {
    margin: 0 0 10px;
    color: #333;
    font-size: 14px;
}
.drawing-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.drawing-buttons button {
    padding: 8px 12px;
    font-size: 12px;
}
.drawing-status {
    font-size: 12px;
    color: #666;
    padding: 8px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
}
.drawing-status.active {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active {
    display: flex;
}
.modal-panel {
    background: white;
    border-radius: 8px;
    padding: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.modal-panel h3 {
    margin: 0 0 20px;
    color: #333;
    font-size: 1.25rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.modal-section {
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
}
.modal-section h4 {
    margin: 0 0 10px;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
}
.modal-section .info-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}
.modal-section .info-label {
    color: #666;
}
.modal-section .info-value {
    color: #333;
    font-weight: 500;
}
.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.modal-buttons button {
    flex: 1;
}

/* Confirmation modal */
.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.confirm-modal.active {
    display: flex;
}
.confirm-modal-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
}
.confirm-modal-content h3 {
    margin: 0 0 15px;
    color: #333;
    font-size: 1.1rem;
}
.confirm-modal-content p {
    margin: 0 0 20px;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}
.confirm-modal-content .modal-buttons {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}
.confirm-modal-content.success h3 {
    color: #28a745;
}
.confirm-modal-content.error h3 {
    color: #dc3545;
}
.confirm-modal-content.warning h3 {
    color: #856404;
}
