/* ==========================================================
   RTV Noord Editor Tools
   Gebaseerd op RTV Noord design systeem (intern thema)
   ========================================================== */

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── RTV Noord Design Tokens (intern thema) ─────────────── */
[data-theme="intern"] {
    --rn-orange:        #eeb17a;
    --rn-orange-tint:   #fdf0e3;
    --rn-orange-dark:   #7a4210;

    --rn-blue:          #7892bf;
    --rn-blue-tint:     #e2e9f4;
    --rn-blue-dark:     #2a4a7a;

    --rn-white:         #ffffff;
    --rn-bg:            #faf8f5;
    --rn-surface:       #ffffff;
    --rn-text:          #1a1a1a;
    --rn-text-muted:    #666666;
    --rn-border:        rgba(0, 0, 0, 0.10);

    /* Harde schaduwen — warm bruin */
    --rn-shadow-sm:     2px 2px 0px #8a6030;
    --rn-shadow:        3px 3px 0px #8a6030;
    --rn-shadow-md:     4px 4px 0px #8a6030;
    --rn-shadow-lg:     6px 6px 0px #8a6030;
    --rn-shadow-hover:  5px 5px 0px #8a6030;

    --rn-primary:       var(--rn-orange);
    --rn-primary-tint:  var(--rn-orange-tint);
    --rn-primary-dark:  var(--rn-orange-dark);
    --rn-primary-text:  #1a1a1a;
}

/* ── Base ───────────────────────────────────────────────── */
body {
    font-family: "ff-din-paneuropean", 'Arial Narrow', Arial, sans-serif;
    background-color: var(--rn-bg);
    color: var(--rn-text);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── App Layout ─────────────────────────────────────────── */
.app {
    display: flex;
    height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--rn-surface);
    border-right: 2px solid var(--rn-text);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 2px solid var(--rn-text);
}

.rn-logo {
    font-family: "ff-din-paneuropean-cond", "ff-din-paneuropean", Arial, sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.2;
    color: var(--rn-text);
}

.sidebar-subtitle {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--rn-text-muted);
}

.tool-list {
    list-style: none;
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.tool-list li {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--rn-text-muted);
    transition: all 0.1s;
    border-left: 3px solid transparent;
}

.tool-list li:hover {
    color: var(--rn-text);
    background: var(--rn-orange-tint);
}

.tool-list li.active {
    color: var(--rn-text);
    font-weight: 700;
    background: var(--rn-orange-tint);
    border-left-color: var(--rn-orange);
}

.tool-list li .tool-icon {
    margin-right: 8px;
}

.tool-list li.tool-group {
    padding: 14px 20px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rn-text-muted);
    cursor: default;
    border-left: none;
    background: transparent;
}

.tool-list li.tool-group:hover {
    background: transparent;
    color: var(--rn-text-muted);
}

.tool-list li.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tool-list li.disabled:hover {
    background: transparent;
    color: var(--rn-text-muted);
}

/* ── Main Content ───────────────────────────────────────── */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--rn-text-muted);
}

.welcome h2 {
    font-family: "ff-din-paneuropean-cond", "ff-din-paneuropean", Arial, sans-serif;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--rn-text);
}

/* ── Tool Layout ────────────────────────────────────────── */
.tool-container {
    display: flex;
    flex: 1;
    height: 100%;
}

.tool-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tool-panel {
    width: 320px;
    min-width: 320px;
    background: var(--rn-surface);
    border-left: 2px solid var(--rn-text);
    overflow-y: auto;
    padding: 20px;
}

/* ── Panel Sections ─────────────────────────────────────── */
.panel-section {
    margin-bottom: 24px;
}

.panel-section h3 {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--rn-text-muted);
    margin-bottom: 10px;
}

/* ── Form Elements (RTV Noord style) ────────────────────── */
.input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.input-group input[type="text"],
.input-group input[type="number"] {
    flex: 1;
}

input[type="text"],
input[type="number"],
select {
    font-family: inherit;
    font-size: 14px;
    padding: 10px 14px;
    border: 2px solid var(--rn-text);
    border-radius: 8px;
    background: var(--rn-surface);
    color: var(--rn-text);
    width: 100%;
    outline: none;
    transition: box-shadow 0.15s;
}

input:focus,
select:focus {
    box-shadow: var(--rn-shadow);
    border-color: var(--rn-orange);
}

input::placeholder {
    color: var(--rn-text-muted);
}

label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--rn-text-muted);
    display: block;
    margin-bottom: 6px;
}

.field {
    margin-bottom: 12px;
}

.field-row {
    display: flex;
    gap: 12px;
}

.field-row .field {
    flex: 1;
}

/* ── Buttons (RTV Noord — pill shape, hard shadow) ──────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 10px 20px;
    border-radius: 999px;
    border: 2px solid var(--rn-text);
    cursor: pointer;
    transition: box-shadow 0.1s ease, transform 0.1s ease;
    box-shadow: var(--rn-shadow);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    box-shadow: var(--rn-shadow-hover);
    transform: translate(-1px, -1px);
}

.btn:active {
    box-shadow: var(--rn-shadow-sm);
    transform: translate(1px, 1px);
}

.btn-primary {
    background: var(--rn-orange);
    color: var(--rn-text);
}

.btn-secondary {
    background: var(--rn-surface);
    color: var(--rn-text);
}

.btn-success {
    background: var(--rn-blue);
    color: #ffffff;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* ── Map Viewport ───────────────────────────────────────── */
.map-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--rn-bg);
    cursor: grab;
    border-bottom: 2px solid var(--rn-text);
}

.map-viewport:active {
    cursor: grabbing;
}

.map-viewport.mode-calibrate {
    cursor: crosshair;
}

.map-canvas-wrap {
    position: absolute;
    transform-origin: 0 0;
}

.map-canvas-wrap img {
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* ── Loading Overlay ────────────────────────────────────── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: var(--rn-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.loading-box {
    text-align: center;
}

.loading-box p {
    margin-top: 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--rn-text-muted);
    letter-spacing: 0.02em;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--rn-border);
    border-top-color: var(--rn-orange);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Calibration Points ─────────────────────────────────── */
.calib-point {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--rn-orange);
    border: 2px solid var(--rn-text);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: move;
    z-index: 20;
    box-shadow: var(--rn-shadow-sm);
}

.calib-point .calib-label {
    position: absolute;
    left: 18px;
    top: -3px;
    font-size: 11px;
    font-weight: 700;
    color: var(--rn-text);
    white-space: nowrap;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Status Bar ─────────────────────────────────────────── */
.status-bar {
    height: 36px;
    min-height: 36px;
    background: var(--rn-surface);
    border-top: 2px solid var(--rn-text);
    color: var(--rn-text-muted);
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 12px;
    font-weight: 500;
    gap: 16px;
}

.status-bar .status-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Progress ───────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--rn-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
    border: 1px solid var(--rn-border);
}

.progress-bar .progress-fill {
    height: 100%;
    background: var(--rn-orange);
    border-radius: 3px;
    transition: width 0.1s;
    width: 0%;
}

/* ── Toast Notifications ────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 52px;
    right: 20px;
    background: var(--rn-text);
    color: var(--rn-bg);
    border: 2px solid var(--rn-text);
    border-radius: 999px;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 700;
    z-index: 1000;
    animation: toastIn 0.2s ease;
    box-shadow: var(--rn-shadow-md);
}

.toast-success {
    background: var(--rn-blue);
    border-color: var(--rn-blue-dark);
}

.toast-error {
    background: #c0392b;
    border-color: #8b1a1a;
}

@keyframes toastIn {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ── Toggle ─────────────────────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.toggle-row label {
    margin-bottom: 0;
}

.toggle {
    position: relative;
    width: 40px;
    height: 22px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle .slider {
    position: absolute;
    inset: 0;
    background: var(--rn-bg);
    border: 2px solid var(--rn-text);
    border-radius: 999px;
    cursor: pointer;
    transition: 0.15s;
}

.toggle .slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    top: 2px;
    background: var(--rn-text-muted);
    border-radius: 50%;
    transition: 0.15s;
}

.toggle input:checked + .slider {
    background: var(--rn-orange);
}

.toggle input:checked + .slider::before {
    transform: translateX(18px);
    background: var(--rn-text);
}

/* ── Calibration List ───────────────────────────────────── */
.calib-list {
    list-style: none;
    font-size: 12px;
    margin-top: 10px;
}

.calib-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--rn-border);
}

.calib-list li .calib-name {
    color: var(--rn-text);
    font-weight: 700;
}

.calib-list li .calib-coords {
    color: var(--rn-text-muted);
    font-size: 11px;
}

.calib-list li .btn-remove {
    background: none;
    border: none;
    color: var(--rn-text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
}

.calib-list li .btn-remove:hover {
    color: #c0392b;
    background: rgba(192,57,43,0.1);
}

/* ── Render Overlay ─────────────────────────────────────── */
.render-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.render-dialog {
    background: var(--rn-surface);
    border: 2px solid var(--rn-text);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    min-width: 320px;
    box-shadow: var(--rn-shadow-lg);
}

.render-dialog h3 {
    font-family: "ff-din-paneuropean-cond", "ff-din-paneuropean", Arial, sans-serif;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.render-dialog p {
    color: var(--rn-text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--rn-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--rn-text-muted);
}
