/* Window-maximized layout for AllSky7 Meteor Database */

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

html, body {
    height: 100%;
    overflow: hidden; /* Prevent body scroll, table will handle scroll */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Header */
.app-header {
    background: #2c3e50;
    color: white;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Don't shrink */
    min-height: 50px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left h1 {
    font-size: 1.4rem;
    margin: 0;
}

.status-badge {
    font-size: 0.8rem;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Controls Row */
.controls-section {
    background: white;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0; /* Don't shrink */
    min-height: 40px;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 15px;
}

.controls-left h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    min-width: 0; /* Allow shrinking of container */
}

/* Filter controls styling */
.filter-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: max-content; /* Force minimum width based on content */
}

/* Mobile responsive */
@media (max-width: 768px) {
    .controls-section {
        padding: 8px 8px;
        gap: 10px;
        /* Enable smooth scrolling */
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        /* Force content to not shrink below natural size */
        flex-wrap: nowrap;
    }

    .controls-left h3 {
        font-size: 1rem;
        margin-right: 10px;
    }

    .controls-right {
        gap: 8px;
    }

    .filter-controls {
        gap: 4px;
        padding: 4px 6px;
        /* Ensure controls maintain their minimum width */
        min-width: 600px; /* Force horizontal scroll by setting minimum width */
    }

    .filter-controls label {
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Fixed width inputs to prevent shrinking */
    .date-input {
        width: 100px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .station-select,
    .status-select {
        font-size: 0.8rem;
        width: 90px;
        flex-shrink: 0;
    }

    .btn-small {
        font-size: 0.8rem;
        padding: 4px 8px;
        flex-shrink: 0;
        white-space: nowrap;
    }
}

.filter-controls label {
    font-size: 0.9rem;
    color: #2c3e50;
    margin: 0;
}

/* Toolbar buttons responsive */
.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-btn .icon {
    flex-shrink: 0;
}

.toolbar-btn .text {
    white-space: nowrap;
}

/* Simple responsive toolbar - use em units for font-size scaling */
@media (max-width: 30em) {
    .toolbar-btn .text {
        display: none;
    }

    .toolbar-btn {
        padding: 8px 10px;
        min-width: 44px;
        justify-content: center;
    }
}

.date-input {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9rem;
    width: 130px;
}

.status-select {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9rem;
    width: 110px;
    background: white;
}

.station-select {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9rem;
    width: 120px;
    background: white;
}

/* Table Container - takes remaining space */
.table-container {
    flex: 1; /* Take all remaining space */
    background: white;
    overflow: hidden; /* Let Tabulator handle scrolling */
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow shrinking below content width */
}

/* Ensure Tabulator table fits container properly */
#meteor-table {
    width: 100%;
    height: 100%;
}

/* Fix for Tabulator header/column sync issues */
.tabulator .tabulator-header {
    overflow: hidden;
}

.tabulator .tabulator-tableholder {
    overflow: auto;
}

/* Buttons */
button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

button:hover {
    background: #2980b9;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 3px;
}

/* Inline Results */
.inline-result {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.inline-result.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Auth Status */
.auth-status {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
}

.auth-status.authenticated {
    color: #2ecc71;
}

.auth-status.invalid {
    color: #e74c3c;
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    min-width: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-top: 0;
    color: #2c3e50;
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}

.modal-buttons button {
    padding: 8px 16px;
}

/* Meteor table container */
#meteor-table-container {
    margin: 20px 0;
}

#meteor-table-container h2 {
    color: #2c3e50;
    margin-bottom: 15px;
}

/* Tabulator table customization */
.tabulator {
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Make sortable column headers more prominent */
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover {
    background-color: #d5d5d5 !important;
    cursor: pointer;
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title {
    padding-right: 25px; /* Space for sort arrow */
}

/* Vertical Action Column */
.action-column {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    height: 56px; /* Slightly less than 60px image height */
    justify-content: center;
}

/* Subtle Action Buttons */
.action-btn-subtle {
    padding: 2px 4px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 10px;
    width: 24px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 1.0; 
}

.action-btn-subtle:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Subtle button colors - muted versions */
.action-btn-subtle.btn-image {
    background: #bdc3c750;
    color: #34495e;
}

.action-btn-subtle.btn-video {
    background: #bdc3c750;
    color: #34495e;
}

.action-btn-subtle.btn-raw {
    background: #bdc3c750;
    color: #34495e;
}

.action-btn-subtle.btn-image:hover {
    background: #3498db;
    color: white;
}

.action-btn-subtle.btn-video:hover {
    background: #e74c3c;
    color: white;
}

.action-btn-subtle.btn-raw:hover {
    background: #95a5a6;
    color: white;
}

/* Select2 Classification Control Styling */
.classification-select {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9rem;
    width: 200px;
    background: white;
}

/* Select2 Container - Clean single-line display */
.select2-container {
    max-width: 200px;
    min-width: 200px;
}

.select2-container .select2-selection--multiple {
    max-width: 200px;
    min-height: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 4px 8px;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    align-items: center;
}

/* Selection summary styling */
.selection-summary {
    color: #333;
    font-size: 0.9rem;
    font-weight: normal;
}

.selection-placeholder {
    color: #999;
    font-size: 0.9rem;
    font-style: italic;
}

/* Multi-checkboxes plugin styling */
.select2-results__option .wrap::before {
    content: "☐";
    color: #999;
    font-size: 14px;
    margin-right: 8px;
    width: 16px;
    display: inline-block;
}

.select2-results__option[aria-selected="true"] .wrap::before {
    content: "☑";
    color: #28a745;
}

/* Multi-station event badge on thumbnail */
.multi-station-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Badge for meteors in correlation pairs (higher correlation) */
.multi-station-badge.in-pair {
    background: rgba(255, 140, 0, 0.75); /* Orange - strong correlation */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.multi-station-badge.in-pair::before {
    content: "⚯"; /* Three lines with connection - represents correlation */
}

.multi-station-badge.in-pair:hover {
    transform: scale(1.15);
    background: rgba(255, 140, 0, 0.9);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

/* Badge for meteors in multi-station events only (no pair) */
.multi-station-badge.in-event {
    background: rgba(0, 120, 255, 0.75); /* Blue - general event */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.multi-station-badge.in-event::before {
    content: "○"; /* Circle - represents general grouping */
}

.multi-station-badge.in-event:hover {
    transform: scale(1.15);
    background: rgba(0, 120, 255, 0.9);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}
}