/* Control panel specific styling */
.control-panel {
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

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

/* Item properties popup - fixed position at bottom center */
.item-properties-popup {
    position: fixed;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 280px;
    z-index: 9999;
}

.item-properties-popup.hidden {
    display: none;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    border-radius: 8px 8px 0 0;
}

.popup-title {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.popup-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
    line-height: 1;
}

.popup-close:hover {
    color: #e74c3c;
}

/* Passenger popup header variant */
.passenger-popup-header {
    background: #9b59b6;
}

.passenger-popup-header .popup-title {
    color: white;
}

.passenger-popup-header .popup-close {
    color: white;
    opacity: 0.8;
}

.passenger-popup-header .popup-close:hover {
    opacity: 1;
    color: white;
}

.popup-rows {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: auto;
    margin-right: 8px;
}

.popup-unit {
    color: #666;
    font-size: 12px;
    margin-left: 4px;
}

.popup-content {
    padding: 12px;
}

.popup-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.popup-row:last-child {
    margin-bottom: 0;
}

.popup-row label {
    flex: 0 0 90px;
    font-size: 12px;
    color: #666;
}

.popup-row input {
    flex: 1;
    min-width: 0;
    max-width: 150px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.popup-row input:focus {
    outline: none;
    border-color: #3498db;
}

/* Checkbox row in popup */
.popup-row-checkbox {
    background: #f8f9fa;
    margin: 8px -12px -12px -12px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    border-radius: 0 0 8px 8px;
}

.popup-row-checkbox .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    font-size: 12px;
    color: #666;
}

.popup-row-checkbox .popup-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #f39c12;
}

.popup-row-checkbox span {
    color: #f39c12;
    font-weight: 500;
}

/* Passenger Popup */
.passenger-popup {
    position: fixed;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 450px;
    max-width: 90vw;
    z-index: 9999;
}

.passenger-popup.hidden {
    display: none;
}

.pax-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #9b59b6;
    color: white;
    border-radius: 8px 8px 0 0;
}

.pax-popup-title {
    font-weight: 600;
    font-size: 14px;
}

.pax-popup-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: white;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
}

.pax-popup-close:hover {
    opacity: 1;
}

.pax-popup-content {
    padding: 12px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Passenger Grid */
.pax-popup-grid {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.pax-popup-grid th {
    background: #9b59b6;
    color: white;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
}

.pax-popup-grid th:first-child {
    border-radius: 4px 0 0 0;
}

.pax-popup-grid th:last-child {
    border-radius: 0 4px 0 0;
}

.pax-popup-grid td {
    text-align: center;
    padding: 4px;
    border: 1px solid #eee;
}

.pax-popup-grid .row-label {
    background: #f8f9fa;
    font-weight: 500;
    font-size: 12px;
    padding: 8px;
    width: 60px;
}

.pax-cell-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    background: #f5f5f5;
    transition: all 0.15s;
}

.pax-cell-btn:hover {
    border-color: #9b59b6;
    background: #f0e6f6;
}

.pax-cell-btn[data-state="1"],
.pax-cell-btn[data-state="2"],
.pax-cell-btn[data-state="3"] {
    background: #9b59b6;
    color: white;
    border-color: #7b3fa0;
}

/* Passenger Section Inputs in Popup */
.pax-popup-sections {
    border-top: 1px solid #eee;
    padding-top: 12px;
}

.pax-popup-section {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
}

.pax-popup-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    color: #9b59b6;
}

.pax-popup-section-inputs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.pax-popup-input-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pax-popup-input-group label {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
}

.pax-popup-input-group input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}

.pax-popup-input-group input:focus {
    outline: none;
    border-color: #9b59b6;
}

/* Popup Actions */
.pax-popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.pax-popup-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pax-apply-btn {
    background: #9b59b6;
    color: white;
    border: none;
}

.pax-apply-btn:hover {
    background: #8e44ad;
}

.pax-clear-btn {
    background: white;
    color: #666;
    border: 1px solid #ddd;
}

.pax-clear-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* Preview badges for sections */
.pax-sections-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.pax-preview-badge {
    background: #f0e6f6;
    color: #7b3fa0;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Charts section - always full width below other controls */
.charts-section {
    flex: 1 1 100% !important;
    width: 100%;
    margin-top: 12px;
}

.control-group label {
    flex-direction: row;
    white-space: nowrap;
}

.control-group button {
    margin-top: 8px;
}

/* Button groups */
.control-group .btn-small + .btn-small {
    margin-top: 4px;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .control-panel {
        flex-wrap: wrap;
    }

    .control-group {
        min-width: 180px;
    }
}

@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 200px 1fr 250px;
    }
}

@media (max-width: 768px) {
    .dashboard {
        grid-template-areas:
            "header"
            "main"
            "controls";
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr auto;
    }

    .sidebar-left,
    .sidebar-right {
        display: none;
    }

    .control-panel {
        flex-direction: column;
        max-height: 200px;
        overflow-y: auto;
    }
}
