* { box-sizing: border-box; }

:root {
    /* Brand palette — shared across suite and landing page */
    --green-dark:  #1a3a2a;
    --green-mid:   #2d6a4f;
    --green-light: #40916c;
    --gold:        #d4a017;
    --gold-light:  #f0c040;
    --cream:       #f8f4ec;
    --slate:       #2b3240;
    --slate-light: #4a5568;
    --white:       #ffffff;
    --shadow:      rgba(0,0,0,0.12);

    /* App semantic tokens */
    --conductor-primary: var(--green-mid);
    --conductor-secondary: #008000;
    --conductor-success: #198754;
    --conductor-info: #0dcaf0;
    --conductor-warning: var(--gold);
    --conductor-danger: #dc3545;
    --conductor-light: #f8f9fa;
    --conductor-dark: var(--slate);

    --brand-main: var(--green-mid);
    --brand-header: var(--green-dark);
    --brand-accent: var(--gold);

    --conductor-spacing-sm: 0.5rem;
    --conductor-spacing-md: 1rem;
    --conductor-spacing-lg: 2rem;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.conductor-header {
    background-color: var(--brand-header) !important;
    color: white !important;
    padding: 1rem 1.25rem !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conductor-header h1 {
    font-size: 1.25rem !important;
    margin: 0;
    color: white !important;
}

.conductor-header.fixed-top {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 3000 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4) !important;
    transform: translateZ(0);
}

.conductor-header.theme-official { background-color: var(--brand-header) !important; }
.conductor-header.theme-utils { background-color: #7f8c8d !important; }

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

#header-back-btn, .header-back-link {
    background: transparent;
    border: none;
    padding: 8px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white !important;
    cursor: pointer;
    text-decoration: none;
}

#header-back-btn svg, .header-back-link svg { fill: white; }

.hidden { display: none !important; }

main {
    padding: var(--conductor-spacing-md);
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

main.has-fixed-header {
    padding-top: 5.5rem !important;
}

/* ── Compact Judge Scoring Form ────────────────────────────────── */
#view-scoring {
    /* Bleed edge-to-edge — counteract main's 1rem side padding */
    margin: -0.5rem -1rem 0 -1rem;
}

#scoring-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    padding: 0.3rem 0.75rem 0.1rem;
    line-height: 1.2;
}

#scoring-team {
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    margin: 0;
    padding: 0 0.75rem 0.3rem;
}

#score-form {
    border-top: 2px solid var(--brand-main);
}

.score-field-row {
    min-height: 40px;
    background: #fff;
}

.score-field-row:nth-child(even) {
    background: #f8f9fa;
}

.score-field-row.score-field-wide {
    display: block;
}

.score-field-label {
    flex: 1 1 0;
    min-width: 0;
}

.score-field-input {
    flex: 0 0 120px;
    width: 120px;
}

/* Override global judge-app input styles inside compact score rows */
.score-field-input input[type="text"],
.score-field-input input[type="number"],
.score-field-input select {
    padding: 0.25rem 0.4rem !important;
    font-size: 0.875rem !important;
    margin-bottom: 0 !important;
    height: auto !important;
}

.score-field-wide textarea {
    padding: 0.25rem 0.4rem !important;
    font-size: 0.875rem !important;
    margin-bottom: 0 !important;
    min-height: 48px !important;
    height: 48px !important;
}

#btn-submit {
    display: block;
    width: calc(100% - 1.5rem);
    margin: 0.5rem 0.75rem;
}

.card {
    background: white;
    padding: 1rem;
    border-radius: 8px !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
    margin-bottom: 1rem;
    border-left: 5px solid var(--brand-accent) !important;
}

/* Judge UI Buttons */
.judge-app .btn {
    display: block;
    width: 100%;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border: none;
    border-radius: 4px;
    background-color: var(--brand-main);
    color: white !important;
    font-size: 1.1rem;
    cursor: pointer;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.2s;
}

.judge-app .btn:hover { opacity: 0.9; }

.judge-app .btn-outline {
    background-color: transparent !important;
    border: 2px solid var(--brand-main) !important;
    color: var(--brand-main) !important;
}

.judge-app .btn-outline:hover, .judge-app .btn-outline:focus {
    background-color: rgba(13, 110, 253, 0.05) !important;
    color: var(--brand-main) !important;
}

.judge-app .btn-secondary { background-color: var(--conductor-secondary) !important; }
.judge-app .btn-success { background-color: var(--conductor-success) !important; }
.judge-app .btn-warning { background-color: var(--conductor-warning) !important; color: #212529 !important; }
.judge-app .btn-danger { background-color: var(--conductor-danger) !important; }

/* Small buttons (like Start/Reset in lists) shouldn't be 100% width */
.judge-app .btn-sm {
    display: inline-flex !important;
    width: auto;
    padding: 0.4rem 0.8rem !important;
    font-size: 0.875rem !important;
    margin-bottom: 0 !important;
    align-items: center;
    justify-content: center;
}

.status-indicator {
    padding: 0.5rem 1rem !important;
    border-radius: 4px !important;
    font-weight: bold !important;
    border: none !important;
    color: white !important;
}
.status-online { background-color: var(--conductor-secondary) !important; }
.status-offline { background-color: var(--conductor-danger) !important; }
.status-sync { background-color: #b8860b !important; cursor: pointer; }

.judge-app h2 { margin-top: 1rem; margin-bottom: 1rem; font-size: 1.5rem; }
.judge-app h3 { margin-top: 1.5rem; margin-bottom: 1rem; font-size: 1.25rem; font-weight: bold; }

.list-group-item {
    padding: 8px 15px !important;
    font-size: 0.95rem;
}

.stopwatch-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #212529 !important;
    color: white;
    height: 80px;
    z-index: 1050;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}
.stopwatch-dock.active { transform: translateY(0); }

#stopwatch-dock .btn {
    padding: 0;
    line-height: 48px;
    height: 48px;
    display: inline-block;
    width: 80px;
}

/* Judge UI Inputs */
.judge-app input[type="text"],
.judge-app input[type="number"],
.judge-app input[type="email"],
.judge-app select,
.judge-app textarea {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Fix for stopwatch/input-group layout */
.judge-app .input-group {
    display: flex !important;
    flex-wrap: nowrap !important;
}

.judge-app .input-group input {
    width: 1px !important;
    flex: 1 1 auto !important;
    margin-bottom: 0 !important;
    padding: 0.4rem !important;
    font-size: 1rem !important;
    text-align: center !important;
}

.judge-app .input-group-text {
    background-color: #eee !important;
    border: 1px solid #ccc !important;
    padding: 0.4rem 0.6rem !important;
    margin-bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
}

.range-display {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--brand-main);
}

.judge-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Admin Dashboard */
.dashboard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin-top: 30px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 900px;
}

.dashboard-link-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px !important;
    font-size: 1.2rem !important;
    background-color: white;
    color: #2c3e50;
    border: 3px solid var(--brand-accent);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    height: 160px !important;
    text-decoration: none;
    font-weight: bold;
}

.dashboard-link-btn:hover:not(.disabled) {
    background-color: var(--brand-accent);
    color: white !important;
    transform: translateY(-5px);
}

.dashboard-icon { font-size: 2.5rem !important; margin-bottom: 10px; }

.dashboard-footer {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Announcer Sheet */
.announcer-block {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 0.4in;
    border-left: 4px solid var(--brand-main, #2c3e50);
    padding-left: 0.2in;
}
.announcer-game-title {
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.1in;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4px;
}
.announcer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
}
.announcer-table td {
    padding: 3px 8px 3px 0;
    vertical-align: top;
}
.announcer-rank { width: 1in; font-weight: bold; white-space: nowrap; }
.announcer-entity { font-weight: bold; }
.announcer-troop { color: #555; padding-left: 0.1in; }
.announcer-score { color: #555; text-align: right; width: 0.8in; }

/* Sticker / Award label table */
.sticker-table,
.sticker-preview-table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}
.sticker-table td,
.sticker-preview-table td {
    width: 3.3in;
    padding: 0.1in 0.15in;
    vertical-align: middle;
    box-sizing: border-box;
}
.sticker-table tbody,
.sticker-preview-table tbody {
    break-inside: avoid;
    page-break-inside: avoid;
}
.sticker-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media print {
    .no-print, header, nav, .controls, .btn, .card-footer, .stopwatch-dock { display: none !important; }
    body { background-color: white !important; }
    @page { margin: 0.5in; }
    main { padding: 0 !important; }
    .print-only { display: block !important; }
}

/* Composer Split-Pane IDE Layout */
#composer-layout {
    display: flex;
    height: calc(100vh - 56px); /* Adjusted for Bootstrap Navbar */
    overflow: hidden;
}

#library-sidebar {
    width: 300px;
    flex-shrink: 0;
    overflow-y: auto;
    border-right: 1px solid #ddd;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

#composer-main-pane {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f4f6f9;
}

#library-sidebar .sidebar-header {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

#library-list .library-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

#library-list .library-item:hover {
    background-color: #e9ecef;
}

#library-list .library-item .item-title {
    font-weight: 600;
    color: #2c3e50;
    display: block;
}

#library-list .library-item .item-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

#library-list .library-item .badge {
    float: right;
    font-size: 0.7rem;
}

@media (max-width: 992px) {
    #composer-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    #library-sidebar {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        height: 300px;
    }
}

/* Tabs Styling for Composer */
.nav-tabs .nav-link {
    color: #495057;
    border: none;
    border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link.active {
    font-weight: bold !important;
    color: var(--conductor-primary) !important;
    border: none !important;
    border-bottom: 3px solid var(--conductor-primary) !important;
    background: transparent !important;
}

/* Sidebar Resizer */
.sidebar-resizer {
    width: 6px;
    background-color: #dee2e6;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background-color 0.2s;
    z-index: 100;
}

.sidebar-resizer:hover, .sidebar-resizer.resizing {
    background-color: var(--brand-accent);
}
