/* Sardaukiosk Dark Theme */
:root {
    --bs-body-bg: #1a1a2e;
    --bs-body-color: #e0e0e0;
    --sidebar-bg: #16213e;
    --sidebar-active: #0f3460;
    --accent: #e87a2a;
    --card-bg: #16213e;
}

html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    height: 100%;
    margin: 0;
}

/* Layout */
.page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar .brand {
    padding: 1rem 1.2rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-decoration: none;
    display: block;
}

.sidebar .nav-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.sidebar .nav-item {
    padding: 0 0.5rem;
}

.sidebar .nav-link {
    color: #b0b0b0;
    padding: 0.6rem 1rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.15s;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.08);
}

.sidebar .nav-link.active {
    color: #fff;
    background-color: var(--sidebar-active);
}

.sidebar .nav-section {
    padding: 0.8rem 1.2rem 0.3rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #666;
    font-weight: 600;
}

.sidebar .user-info {
    padding: 0.8rem 1.2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
    color: #888;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-row {
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

.top-row a {
    color: #b0b0b0;
    text-decoration: none;
    font-size: 0.875rem;
}

.top-row a:hover {
    color: #fff;
}

.content {
    padding: 1.5rem;
    flex: 1;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.1);
}

.card-header {
    background-color: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255,255,255,0.03);
    --bs-table-hover-bg: rgba(255,255,255,0.06);
    color: var(--bs-body-color);
}

/* Form controls dark */
.form-control, .form-select {
    background-color: rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.15);
    color: var(--bs-body-color);
}

.form-control:focus, .form-select:focus {
    background-color: rgba(0,0,0,0.4);
    border-color: var(--accent);
    color: var(--bs-body-color);
    box-shadow: 0 0 0 0.2rem rgba(232,122,42,0.35);
}

/* Buttons */
.btn-primary {
    background-color: var(--accent);
    border-color: var(--accent);
}

.btn-primary:hover {
    background-color: #cf6a1f;
    border-color: #cf6a1f;
}

/* Badge styles */
.badge-html {
    background-color: #0f3460;
    color: #7ec8e3;
}

.badge-image {
    background-color: #2d4a22;
    color: #8fbc8f;
}

.badge-svg {
    background-color: #4a2d5e;
    color: #c8a2e8;
}

/* SVG slide in player */
.svg-slide-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.svg-slide-wrapper svg {
    width: 100%;
    height: 100%;
}

/* Modal dark */
.modal-content {
    background-color: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--bs-body-color);
}

.modal-header {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.modal-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Nav tabs */
.nav-tabs {
    border-bottom-color: rgba(255,255,255,0.15);
}

.nav-tabs .nav-link {
    color: #b0b0b0;
}

.nav-tabs .nav-link.active {
    background-color: var(--card-bg);
    border-color: rgba(255,255,255,0.15) rgba(255,255,255,0.15) var(--card-bg);
    color: #fff;
}

.nav-tabs .nav-link:hover {
    border-color: rgba(255,255,255,0.1);
    color: #fff;
}

/* Slide card in editor */
.slide-card {
    background-color: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: grab;
    transition: border-color 0.15s;
}

.slide-card:hover {
    border-color: var(--accent);
}

.slide-card .slide-preview {
    width: 120px;
    height: 80px;
    border-radius: 0.25rem;
    overflow: hidden;
    background-color: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #666;
    flex-shrink: 0;
}

.slide-card .slide-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Slide preview: HTML content rendered at full size then scaled down */
.slide-preview-html-wrapper {
    width: 120px;
    height: 80px;
    overflow: hidden;
    position: relative;
}

.slide-preview-html-content {
    width: 800px;
    height: 533px;
    transform: scale(0.15);
    transform-origin: top left;
    color: #fff;
    font-size: 16px;
    line-height: 1.4;
    pointer-events: none;
    overflow: hidden;
}

/* Upload drop zone */
.upload-drop-zone {
    position: relative;
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    color: #888;
    margin-bottom: 1rem;
    transition: all 0.2s;
    cursor: pointer;
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
    border-color: var(--accent);
    background-color: rgba(233,69,96,0.05);
    color: #ccc;
}

.upload-drop-zone-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Kiosk player */
.player-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    overflow: hidden;
}

.player-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.player-slide.active {
    opacity: 1;
}

.player-slide.transition-slide {
    transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
}

.player-slide img {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
}

/* HTML slide wrapper: centers the scaled content */
.player-slide .html-slide-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.player-slide .html-slide-content {
    color: #fff;
    font-size: 1.5rem;
    padding: 2rem;
    transform-origin: center center;
    /* JS will set transform: scale(factor) */
}

.player-controls {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
}

.player-container:hover .player-controls {
    opacity: 1;
}

/* Screensaver overlay */
.screensaver-overlay {
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: #000;
}

.screensaver-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.screensaver-dismiss-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: default;
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid var(--accent);
}

.validation-message {
    color: var(--accent);
}

/* Blazor error boundary */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* Radzen overrides for dark theme */
.rz-html-editor {
    background-color: rgba(0,0,0,0.2) !important;
    border-color: rgba(255,255,255,0.15) !important;
}

/* Responsive sidebar toggle */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1000;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(0,0,0,0.5);
    }

    .sidebar-toggle {
        font-size: 1.25rem;
        line-height: 1;
    }
}

#blazor-error-ui {
    background: #b32121;
    padding: 0.5rem 1rem;
    color: white;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 10001;
    display: none;
}

/* ===== SVG Editor Toolbar ===== */
.svg-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    background: #1e1e1e;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    transition: all 0.12s;
}

.tb-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}

.tb-btn:active:not(:disabled) {
    background: rgba(255,255,255,0.18);
}

.tb-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.tb-btn.tb-file {
    width: auto;
    padding: 0 8px;
    border-color: rgba(100,200,255,0.3);
    color: #7ec8e3;
}

.tb-btn.tb-file:hover {
    background: rgba(100,200,255,0.12);
    border-color: rgba(100,200,255,0.5);
}

.tb-btn.tb-danger:not(:disabled) {
    color: #f77;
}

.tb-btn.tb-danger:hover:not(:disabled) {
    background: rgba(255,80,80,0.15);
    border-color: rgba(255,80,80,0.3);
}

.tb-btn.tb-save {
    color: #5f5;
    border-color: rgba(80,255,80,0.3);
    width: auto;
    padding: 0 10px;
}

.tb-btn.tb-save:hover {
    background: rgba(80,255,80,0.15);
    border-color: rgba(80,255,80,0.5);
}

.tb-btn.tb-tiny {
    width: 22px;
    height: 22px;
}

.tb-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.tb-icon-sm {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #999;
}

.tb-sep {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.15);
    margin: 0 4px;
}

.tb-spacer {
    flex: 1;
}

.tb-field {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.tb-input {
    height: 24px;
    padding: 0 4px;
    font-size: 0.75rem;
    color: #ddd;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    outline: none;
}

.tb-input:focus {
    border-color: var(--accent);
}

.tb-select {
    height: 24px;
    padding: 0 4px;
    font-size: 0.75rem;
    color: #ddd;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    outline: none;
}

.tb-select:focus {
    border-color: var(--accent);
}

/* Properties bar */
.svg-props {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #252526;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.prop-group {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.prop-label {
    cursor: pointer;
    margin: 0;
    display: flex;
}

.prop-icon {
    width: 16px;
    height: 16px;
    color: #aaa;
}

.prop-color {
    width: 24px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 3px;
    background: none;
    cursor: pointer;
}

.prop-color::-webkit-color-swatch-wrapper {
    padding: 1px;
}

.prop-color::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.prop-num {
    width: 3rem;
}

.prop-num::-webkit-inner-spin-button {
    opacity: 1;
}

.prop-sep {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.1);
}
