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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #dde3fd 50%, #0617da 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: left;
    margin-bottom: 30px;
    font-size: 1.5rem;
    color: #99caf5;
    background-clip: text;
}

.table-controls {
    margin-top: 5px;
    margin-bottom: 0;
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 5px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: #99caf5;
    color: white;
	font-size: 12px;
	margin: 12px 5px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    color: white;
    font-size: 12px;
    padding: 8px 12px;
}

.btn-danger:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(238, 90, 82, 0.3);
}

.table-container {
    overflow-x: auto;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 15px;
    overflow: hidden;
}

th {
    background: #99caf5;
    padding: 5px 10px;
    font-size: 14px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
}

td {
    padding: 5px;
	font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.3s ease;
}

tr:hover td {
    background-color: #f8f9ff;
}

tr:last-child td {
    border-bottom: none;
}

.editable {
    background: transparent;
    border: 2px solid transparent;
    border-radius: 6px;
    width: 100%;
    font-size: 14px;
	
    transition: all 0.3s ease;
}
.readonly {
    background: transparent;
    border: 2px solid transparent;
    border-radius: 6px;
    width: 100%;
    font-size: 14px;
	color: rgb(150,150,150);
    transition: all 0.3s ease;
}
.readonly:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.editable:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.actions {
    text-align: center;
    width: 200px;
}

.move-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-move {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    font-size: 12px;
    padding: 6px 10px;
    min-width: auto;
}

.btn-move:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-move:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.drag-handle {
    cursor: grab;
    font-size: 14px;
    
    user-select: none;
}

.drag-handle:hover {
    color: #764ba2;
}

.drag-handle:active {
    cursor: grabbing;
}

.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.drop-zone {
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed #667eea;
}

.row-number {
    background: #99caf5;
    width: 50px;
	color: black;
    text-align: center;
    font-weight: bold;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.column-input {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.column-input:focus {
    outline: none;
    border-color: #667eea;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 18px;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.chart-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.chart-container h2 {
    text-align: left;
    color: #99caf5;
    margin-bottom: 20px;
	max-height: 50%;
    font-size: 1.3rem;
    
    background-clip: text;
}

#depthChart {
    width: 800px;
	max-width:100%;
	height: 70%;
	max-height: 70%;
    display: block;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.settings-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 10px;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.settings-section h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
    color: #99caf5;
    background-clip: text;
}

.settings-row {
    display: grid;
    align-items: center;
	grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.input-group input {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 12px;
    transition: border-color 0.3s ease;
    width: 80px;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: #667eea;
}

.stat-card.warning {
    border-color: #FF9500;
}

.stat-card.warning .stat-value {
    background: linear-gradient(45deg, #FF9500, #FF6B00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card.warning:hover {
    border-color: #FF9500;
}

.stat-card.warning-severe {
    border-color: #FF0000;
}

.stat-card.warning-severe .stat-value {
    background: linear-gradient(45deg, #FF0000, #CC0000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card.warning-severe:hover {
    border-color: #FF0000;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: #666;
    font-size: 1rem;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.air-table-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    margin-top: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.air-table-container h2 {
    color: #99caf5;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.air-table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
}

#airTableDisplay {
    border-collapse: collapse;
    background: white;
    font-size: 12px;
}

#airTableDisplay th,
#airTableDisplay td {
    border: 1px solid #e0e0e0;
    padding: 8px;
    text-align: center;
}

#airTableDisplay th {
    background: #99caf5;
    color: white;
    font-weight: bold;
}

#airTableDisplay tr:nth-child(even) {
    background: #f9f9f9;
}

#airTableDisplay tr:hover {
    background: #eff0ff;
}

#airTableDisplay td.highlighted {
    background: linear-gradient(45deg, #667eea, #764ba2) !important;
    color: white;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

#airTableDisplay td.mdd-column {
    background: rgba(102, 126, 234, 0.1);
    font-weight: bold;
}

#airTableDisplay td.nultijd-separator {
    border-left: 3px solid #667eea;
}

#airTableDisplay th.nultijd-separator {
    border-left: 3px solid #667eea;
}

#airTableDisplay td.nultijd-match {
    border-right: 3px solid #667eea;
    border-bottom: 3px solid #667eea;
    border-top: none;
}

#airTableDisplay td.nultijd-match.nultijd-match-no-bottom {
    border-bottom: 1px solid #e0e0e0;
}

#airTableDisplay td.nultijd-connector-bottom {
    border-bottom: 3px solid #667eea;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

h3.collapsible {
    cursor: pointer;
    user-select: none;
    transition: font-size 0.3s;
}

h3.collapsible .collapse-arrow {
    display: inline-block;
    transition: transform 0.3s;
}

h3.collapsible.collapsed {
    font-size: 1rem;
    text-align: left;
}

h3.collapsible.collapsed .collapse-arrow {
    transform: rotate(-90deg);
}

h2.collapsible {
    cursor: pointer;
    user-select: none;
    transition: font-size 0.3s;
}

h2.collapsible .collapse-arrow {
    display: inline-block;
    transition: transform 0.3s;
}

h2.collapsible.collapsed {
    font-size: 1rem;
    text-align: left;
}

h2.collapsible.collapsed .collapse-arrow {
    transform: rotate(-90deg);
}

/* Fallback: hide the immediate content wrapper when a header starts collapsed. 
   This complements the :has() rules for browsers that support it. */
h2.collapsible.collapsed + .table-content-wrapper,
h2.collapsible.collapsed + .air-table-wrapper,
h3.collapsible.collapsed + .settings-row {
    display: none;
}

.settings-section:has(h3.collapsed),
.chart-container:has(h2.collapsed) {
    padding: 10px;
    margin-bottom: 10px;
    transition: padding 0.3s, margin 0.3s;
}

.settings-section h3.collapsible.collapsed,
.chart-container h2.collapsible.collapsed {
    margin-bottom: 0;
}
