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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #fdf5f0;
    color: #333;
    line-height: 1.5;
}

.navbar {
    background: #e8845c;
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
}

.mode-toggle {
    padding: 0.2rem 0.6rem;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-admin {
    background: rgba(255,255,255,0.2);
    color: white;
}

.mode-public {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.nav-links a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    margin-top: 0.25rem;
}

.actions {
    float: right;
}

.back-link {
    color: #e8845c;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.btn-primary {
    background: #e8845c;
    color: white;
}

.btn-primary:hover {
    background: #d6734b;
}

.btn-secondary {
    background: #6c8ebf;
    color: white;
}

.btn-secondary:hover {
    background: #5a7dae;
}

.btn-disabled {
    background: #ddd;
    color: #888;
    cursor: not-allowed;
}

/* Search */
.search-bar {
    margin-bottom: 1rem;
}

.search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Tables */
.episode-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.episode-table th {
    background: #f7f0eb;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #777;
    font-weight: 600;
}

.episode-table td {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #f0e8e3;
    font-size: 0.9rem;
}

.episode-table a {
    color: #c75a2a;
    text-decoration: none;
}

.episode-table a:hover {
    text-decoration: underline;
}

.col-num { width: 3rem; text-align: center; }
.col-type { width: 6rem; }
.col-date { width: 8rem; }
.col-duration { width: 5rem; }
.col-status { width: 4rem; text-align: center; }

.empty-state {
    text-align: center;
    padding: 2rem !important;
    color: #999;
}

/* Status indicators */
.status-yes { color: #4caf50; font-weight: bold; }
.status-no { color: #ccc; }
.status-pending { color: #ff9800; }
.status-fail { color: #f44336; font-weight: bold; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-main { background: #e3f2fd; color: #1565c0; }
.badge-mini { background: #f3e5f5; color: #7b1fa2; }
.badge-movieminute { background: #fff3e0; color: #e65100; }
.badge-liveshow { background: #e8f5e9; color: #2e7d32; }
.badge-rerun { background: #f5f5f5; color: #616161; }

.role-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-host { background: #e8f5e9; color: #2e7d32; }
.role-guest { background: #fff3e0; color: #e65100; }

/* Episode detail */
.episode-meta {
    margin-bottom: 1rem;
}

.meta-item {
    margin-left: 0.75rem;
    color: #777;
    font-size: 0.9rem;
}

.action-panel {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.action-buttons {
    margin-bottom: 0.5rem;
}

.info-row {
    font-size: 0.85rem;
    color: #777;
    margin-top: 0.5rem;
}

.info-row code {
    background: #f5f5f5;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.8rem;
}

.section {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.section h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.description-content {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* People section (editable) */
.people-box {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.people-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.edit-link {
    color: #6c8ebf;
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
}

.edit-link:hover {
    text-decoration: underline;
}

.people-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.person-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.person-tag a {
    color: inherit;
    text-decoration: none;
}

.person-tag a:hover {
    text-decoration: underline;
}

.person-host {
    background: #e8f5e9;
    color: #2e7d32;
}

.person-guest {
    background: #fff3e0;
    color: #e65100;
}

.role-label {
    font-size: 0.75rem;
    opacity: 0.7;
}

.remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.2rem;
    color: #c44;
    font-weight: bold;
}

.remove-btn:hover {
    color: #a00;
}

.people-empty {
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.people-add-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0e8e3;
}

.people-add-form input,
.people-add-form select {
    padding: 0.35rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
}

.people-add-form input {
    width: 200px;
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

/* Autocomplete dropdown */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}

.autocomplete-dropdown:empty {
    display: none;
}

.ac-item {
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.ac-item:hover {
    background: #f7f0eb;
}

.ac-role {
    color: #999;
    font-size: 0.75rem;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.status-done { background: #e8f5e9; color: #2e7d32; }
.status-progress { background: #fff3e0; color: #e65100; }
.status-none { background: #f5f5f5; color: #999; }

.btn-danger { background: #e53935; color: white; }
.btn-danger:hover { background: #c62828; }

.error { color: #c62828; background: #ffebee; padding: 0.5rem 0.75rem; border-radius: 6px; margin: 0.5rem 0; font-size: 0.9rem; }

/* Audio player */
.media-row {
    margin-top: 0.75rem;
}

.audio-player {
    width: 100%;
    max-width: 500px;
    height: 40px;
}

.file-link {
    color: #6c8ebf;
    text-decoration: none;
    font-size: 0.9rem;
}

.file-link:hover {
    text-decoration: underline;
    color: #5a7dae;
}

/* htmx indicator */
.htmx-indicator {
    display: none;
    color: #e8845c;
    font-style: italic;
}

.htmx-request .htmx-indicator {
    display: inline;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-badge {
    display: inline-block;
    font-size: 13px;
    padding: 4px 10px;
    background: #e8e8e8;
    border-radius: 12px;
    color: #333;
}

.prompt-display {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
}

/* Bits — search results */
.search-result {
    border: 1px solid #f0e8e3;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: #fefcfa;
}

.search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.search-result-header a:first-child {
    color: #c75a2a;
    font-weight: 600;
    text-decoration: none;
}

.search-result-header a:first-child:hover {
    text-decoration: underline;
}

.transcript-context {
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 0.8rem;
    line-height: 1.6;
}

.transcript-line {
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}

.transcript-match {
    background: #fff3e0;
    font-weight: 500;
}

.timecode {
    color: #999;
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

.timecode-link {
    color: #6c8ebf;
    text-decoration: none;
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.timecode-link:hover {
    text-decoration: underline;
    color: #5a7dae;
}

/* Bits — creation page */
.bit-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bit-mark-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bit-marker {
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 0.9rem;
    color: #999;
    min-width: 5rem;
}

.bit-marker-set {
    color: #c75a2a;
    font-weight: 600;
}

.bit-time-display {
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 1rem;
}

.bit-form .form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.bit-form .form-group {
    flex: 1;
    min-width: 150px;
}

.bit-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.25rem;
}

.bit-form input[type="text"] {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Transcript viewer */
.transcript-viewer {
    max-height: 600px;
    overflow-y: auto;
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 0.8rem;
    line-height: 1.7;
}

.transcript-playing {
    background: #e3f2fd !important;
    border-radius: 3px;
}

.transcript-viewer-compact {
    max-height: 260px;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.form-group {
    flex: 1;
}

/* Bits — saved bits player bar */
.bit-player-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    border-left: 4px solid #e8845c;
}

.bit-row-playing {
    background: #e3f2fd !important;
}

/* Sortable table headers */
.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background: #efe6df;
}

.sort-arrow {
    font-size: 0.7rem;
    color: #999;
}

.play-btn {
    white-space: nowrap;
}
