/**
 * CEK Indoor Graphics Controller - Control Panel Styles
 * Enhanced tabbed interface matching Time-Team design
 */

/* Layout */
.control-panel {
    max-width: 1800px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--secondary-dark);
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--gray-700);
}

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

.header-logo {
    height: 48px;
    width: auto;
}

.control-header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--white);
    margin: 0;
}

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

.control-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
}

.control-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-500);
    transition: background 0.3s;
}

.control-status-dot.active {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

#status-text {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--gray-400);
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--secondary-dark);
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--gray-700);
}

.top-bar-left {
    flex: 1;
    max-width: 500px;
}

.top-bar-right {
    display: flex;
    gap: 8px;
}

.race-selector {
    width: 100%;
    padding: 10px 16px;
    background: var(--background-dark);
    border: 1px solid var(--gray-600);
    border-radius: 6px;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
}

.race-selector:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn .material-icons {
    font-size: 18px;
}

.btn-block {
    width: 100%;
    justify-content: center;
    margin-bottom: 8px;
}

.btn-primary {
    background: var(--primary);
    color: var(--background-dark);
}
.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: #28a745;
    color: white;
}
.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}
.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}
.btn-warning:hover {
    background: #e0a800;
}

.btn-info {
    background: #17a2b8;
    color: white;
}
.btn-info:hover {
    background: #138496;
}

.btn-blue {
    background: #007bff;
    color: white;
}
.btn-blue:hover {
    background: #0069d9;
}

.btn-pink {
    background: #e83e8c;
    color: white;
}
.btn-pink:hover {
    background: #d63384;
}

.btn-yellow {
    background: #ffc107;
    color: #212529;
}
.btn-yellow:hover {
    background: #e0a800;
}

.btn-white {
    background: #f8f9fa;
    color: #212529;
}
.btn-white:hover {
    background: #e2e6ea;
}

.btn-default {
    background: var(--gray-600);
    color: white;
}
.btn-default:hover {
    background: var(--gray-500);
}

/* Main Content */
.main-content {
    background: var(--secondary-dark);
    border-radius: 8px;
    border: 1px solid var(--gray-700);
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    border-bottom: 2px solid var(--gray-700);
    padding: 0 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px 8px 0 0;
}

.tab-btn {
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: var(--gray-400);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* Tab Content */
.tabs-content {
    flex: 1;
    overflow: hidden;
}

.tab-pane {
    display: none;
    height: 100%;
    flex-direction: column;
}

.tab-pane.active {
    display: flex;
}

.tab-header {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--gray-700);
}

.tab-body {
    flex: 1;
    display: flex;
    padding: 16px;
    gap: 16px;
    overflow: auto;
}

/* Launchpad */
.launchpad-area {
    flex: 1;
    overflow-y: auto;
}

.launchpad-area.full-width {
    flex: 1;
}

.launchpad-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.launchpad-btn {
    position: relative;
    width: calc(12.5% - 6px);
    min-width: 120px;
    padding: 12px 8px;
    background: var(--gray-700);
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.launchpad-btn:hover {
    background: var(--gray-600);
    border-color: var(--gray-500);
}

.launchpad-btn.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--background-dark);
}

.launchpad-btn.selected .launchpad-header,
.launchpad-btn.selected .launchpad-name {
    color: var(--background-dark);
}

.launchpad-idx {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 0.7rem;
    color: var(--gray-500);
}

.launchpad-btn.selected .launchpad-idx {
    color: rgba(0, 0, 0, 0.5);
}

.launchpad-header {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 4px;
    padding-top: 12px;
}

.launchpad-name {
    font-size: 0.75rem;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar Controls */
.sidebar-controls {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-controls h4 {
    color: var(--gray-400);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.sidebar-divider {
    height: 1px;
    background: var(--gray-700);
    margin: 16px 0;
}

/* Radio Groups */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.radio-group.horizontal {
    flex-direction: row;
    gap: 16px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--gray-300);
    font-size: 0.875rem;
}

.radio-label input[type="radio"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-500);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
}

.radio-label input[type="radio"]:checked {
    border-color: var(--primary);
}

.radio-label input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

/* Button-style radio labels */
.radio-label.btn-style {
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.radio-label.btn-style input[type="radio"] {
    display: none;
}

.radio-label.btn-style span {
    width: 100%;
    text-align: center;
}

.radio-label.btn-style.btn-info {
    background: rgba(23, 162, 184, 0.2);
    border: 1px solid #17a2b8;
}
.radio-label.btn-style.btn-info:has(input:checked) {
    background: #17a2b8;
    color: white;
}

.radio-label.btn-style.btn-blue {
    background: rgba(0, 123, 255, 0.2);
    border: 1px solid #007bff;
}
.radio-label.btn-style.btn-blue:has(input:checked) {
    background: #007bff;
    color: white;
}

.radio-label.btn-style.btn-pink {
    background: rgba(232, 62, 140, 0.2);
    border: 1px solid #e83e8c;
}
.radio-label.btn-style.btn-pink:has(input:checked) {
    background: #e83e8c;
    color: white;
}

.radio-label.btn-style.btn-danger {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid #dc3545;
}
.radio-label.btn-style.btn-danger:has(input:checked) {
    background: #dc3545;
    color: white;
}

.radio-label.btn-style.btn-warning {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid #ffc107;
}
.radio-label.btn-style.btn-warning:has(input:checked) {
    background: #ffc107;
    color: #212529;
}

.radio-label.btn-style.btn-yellow {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid #ffc107;
}
.radio-label.btn-style.btn-yellow:has(input:checked) {
    background: #ffc107;
    color: #212529;
}

.radio-label.btn-style.btn-white {
    background: rgba(248, 249, 250, 0.2);
    border: 1px solid #f8f9fa;
}
.radio-label.btn-style.btn-white:has(input:checked) {
    background: #f8f9fa;
    color: #212529;
}

/* Form Groups */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    color: var(--gray-400);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    background: var(--background-dark);
    border: 1px solid var(--gray-600);
    border-radius: 4px;
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Display Type Options */
.display-type-options {
    display: flex;
    flex-direction: column;
}

/* Lower Thirds Tab */
.lower-thirds-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.crew-panel {
    background: var(--background-dark);
    border-radius: 8px;
    border: 1px solid var(--gray-700);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--gray-700);
}

.panel-header h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--white);
    margin: 0;
}

.crew-table-container {
    max-height: 300px;
    overflow-y: auto;
}

.crew-table {
    width: 100%;
    border-collapse: collapse;
}

.crew-table th,
.crew-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-700);
}

.crew-table th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--gray-400);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.crew-table td {
    color: var(--gray-300);
    font-size: 0.875rem;
}

.crew-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.crew-table tbody tr:hover {
    background: rgba(140, 198, 63, 0.1);
}

.crew-table tbody tr.selected {
    background: rgba(140, 198, 63, 0.2);
}

.crew-table tbody tr.selected td {
    color: var(--primary);
}

.crew-table input[type="radio"] {
    cursor: pointer;
}

/* Results Tab */
.results-body {
    flex-direction: column;
}

.results-section {
    margin-bottom: 24px;
}

.results-section h4 {
    color: var(--gray-400);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

/* Podium */
.podium-preview {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: var(--background-dark);
    border-radius: 8px;
    margin-top: 16px;
}

.podium-card {
    width: 200px;
    padding: 24px;
    border-radius: 8px;
    text-align: center;
}

.podium-card.gold {
    background: linear-gradient(135deg, #FFD700, #B8860B);
    order: 2;
    transform: translateY(-20px);
}

.podium-card.silver {
    background: linear-gradient(135deg, #C0C0C0, #808080);
    order: 1;
}

.podium-card.bronze {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
    order: 3;
}

.podium-position {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.3);
    line-height: 1;
}

.podium-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--background-dark);
    margin-top: 8px;
}

/* Webcams Tab */
.webcams-body {
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.webcam-grid {
    display: grid;
    grid-template-columns: repeat(2, 200px);
    gap: 24px;
}

.webcam-slot {
    background: var(--background-dark);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--gray-700);
}

.webcam-label {
    color: var(--gray-400);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.webcam-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--secondary-dark);
    border: 1px solid var(--gray-600);
    border-radius: 4px;
    color: var(--white);
    font-size: 0.875rem;
}

.info-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: 24px;
}

.info-text .material-icons {
    font-size: 18px;
}

/* Manual Lower Thirds Tab */
.manual-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.manual-form {
    background: var(--background-dark);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--gray-700);
}

.manual-preview {
    display: flex;
    flex-direction: column;
}

.manual-preview h4 {
    color: var(--gray-400);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.manual-preview-card {
    background: var(--background-dark);
    border-left: 4px solid var(--primary);
    padding: 20px;
    border-radius: 0 8px 8px 0;
}

.manual-preview-title {
    color: var(--primary);
    font-family: var(--font-display);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.manual-preview-name {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1.1;
}

.manual-preview-subtitle {
    color: var(--gray-400);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Preview Section */
.preview-section {
    background: var(--secondary-dark);
    border-radius: 8px;
    border: 1px solid var(--gray-700);
    padding: 16px;
    margin-bottom: 16px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.preview-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--white);
    margin: 0;
}

.preview-header .material-icons {
    color: var(--primary);
}

.preview-controls {
    display: flex;
    gap: 8px;
}

.preview-container {
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 16 / 9;
}

.preview-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    transform: scale(0.5);
    transform-origin: top left;
    border: none;
}

/* Footer */
.control-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    color: var(--gray-500);
    font-size: 0.75rem;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-primary {
    color: var(--primary);
    font-weight: 600;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}
