/**
 * HTML-Editor Admin UI
 * Farben kommen von :root in admin.php (BRAND_*)
 */
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

#sidebar {
    width: 300px;
    background: var(--sidebar);
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
}
#sidebar h1 {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 5px;
}
.project-info {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 20px;
}
.file-list {
    list-style: none;
    padding: 0;
}
.file-item {
    padding: 12px;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 8px;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.file-item:hover {
    background: #2a2a2a;
    border-color: #444;
}
.file-item.active {
    background: rgba(255, 85, 0, 0.1);
    border-color: var(--primary);
    color: white;
}
.file-item .file-info {
    flex-grow: 1;
    overflow: hidden;
}
.file-item .name {
    font-weight: bold;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-item .meta {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 4px;
}
.delete-btn {
    opacity: 0;
    color: #666;
    transition: all 0.2s;
    padding: 5px;
    border-radius: 4px;
}
.file-item:hover .delete-btn {
    opacity: 1;
}
.delete-btn:hover {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

#main-editor {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
#toolbar {
    min-height: 56px;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
    margin-bottom: 1px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 16px;
}
.toolbar-left {
    flex: 1;
    min-width: 0;
}
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.toolbar-group.viewport-group {
    background: #2a2a2a;
    padding: 4px;
    border-radius: 6px;
}
.toolbar-divider {
    width: 1px;
    height: 28px;
    background: #444;
    flex-shrink: 0;
    border-radius: 1px;
}
.toolbar-icon-btn {
    background: transparent;
    border: none;
    color: #ccc;
    width: 36px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.15s, color 0.15s;
}
.toolbar-icon-btn:hover {
    background: #333;
    color: var(--primary);
}
.viewport-btn.active {
    background: rgba(212, 175, 55, 0.2);
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.3);
}
.toolbar-btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.toolbar-btn.secondary {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #404040;
}
.toolbar-btn.secondary:hover:not(:disabled) {
    background: #333;
    border-color: var(--primary);
    color: #fff;
}
.toolbar-btn.primary {
    background: var(--primary);
    color: #000;
}
.toolbar-btn.primary:hover:not(:disabled) {
    filter: brightness(1.1);
}
.toolbar-status-btn {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    cursor: help;
    padding: 4px 8px;
    border-radius: 4px;
}
.toolbar-status-btn:hover {
    color: var(--text);
    background: #2a2a2a;
}
.editor-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.08);
}
.presence-banner {
    margin-left: 12px;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
}
.details-panel {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: left;
}
.details-panel b {
    color: var(--text);
}
/* Globale Buttons (z. B. Sidebar, Modals) – Toolbar/Ribbon haben eigene Klassen */
button {
    background: var(--primary);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
}
button:hover:not(:disabled) {
    opacity: 0.9;
}
button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}
.toolbar-btn:disabled,
.toolbar-btn.primary:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
    opacity: 0.7;
}
#preview-container {
    flex-grow: 1;
    background: #333;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
#preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}
.placeholder-msg {
    color: var(--muted);
    text-align: center;
}

/* Ribbon Bar (1px Abstand zur Toolbar darüber) */
#ribbon-bar {
    min-height: 52px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 0;
    row-gap: 12px;
    flex-wrap: wrap;
    overflow-x: auto;
    overflow-y: visible;
    flex-shrink: 0;
}
.ribbon-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px 0 0;
    margin-right: 14px;
    border-right: 1px solid #333;
    min-height: 34px;
}
.ribbon-group:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}
.ribbon-label {
    font-size: 0.65rem;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-right: 6px;
    white-space: nowrap;
    min-width: 3.2em;
}
.ribbon-btn {
    background: #2a2a2a;
    border: 1px solid #404040;
    color: #e0e0e0;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-size: 0.9rem;
}
.ribbon-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: var(--primary);
    border-color: rgba(212, 175, 55, 0.5);
}
.ribbon-group select.ribbon-select {
    height: 32px;
    min-width: 52px;
    background: #252525;
    color: #e0e0e0;
    border: 1px solid #404040;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0 8px;
}
.ribbon-group select.ribbon-select-wide {
    min-width: 100px;
    max-width: 120px;
}
.ribbon-group select:hover,
.ribbon-group select:focus {
    border-color: var(--primary);
    outline: none;
}
.ribbon-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ribbon-color-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--muted);
}
.ribbon-group input[type="color"],
.ribbon-color-input {
    width: 28px;
    height: 28px;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 0;
    background: #252525;
    cursor: pointer;
}
.ribbon-btn i {
    font-size: 1rem;
}

/* Dokument-Status (Gespeichert / Synchronisierend / Offline) */
.doc-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 12px;
    padding: 4px 10px;
    border-radius: 6px;
}
.doc-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.doc-status-idle {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.4);
}
.doc-status-idle .doc-status-dot {
    background: #4ade80;
}
.doc-status-syncing {
    color: #facc15;
}
.doc-status-syncing .doc-status-dot {
    background: #facc15;
    animation: pulse 1s infinite;
}
.doc-status-offline {
    color: #f87171;
}
.doc-status-offline .doc-status-dot {
    background: #f87171;
}
.doc-status-unsaved {
    color: var(--primary);
}
.doc-status-unsaved .doc-status-dot {
    background: var(--primary);
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Site-Switcher & Auth Gate */
#site-switcher {
    width: 100%;
    padding: 8px 10px;
    background: #1a1a1a;
    border: 1px solid #444;
    color: var(--text);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-bottom: 12px;
}
#site-switcher:focus {
    outline: 2px solid var(--primary);
}
.site-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: bold;
    margin-left: 6px;
    vertical-align: middle;
}
.site-badge.coach {
    background: rgba(212, 175, 55, 0.2);
    color: #D4AF37;
    border: 1px solid #D4AF37;
}
.site-badge.iron {
    background: rgba(192, 192, 192, 0.2);
    color: #C0C0C0;
    border: 1px solid #C0C0C0;
}
#rb-gate {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}
#gate-pass:focus {
    outline: 2px solid var(--primary);
    border-color: var(--primary);
}

/* Info-Modal (Toolbar-Button „Info“) */
.info-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 28000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.info-modal-content {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 24px;
    border-radius: 12px;
    width: 360px;
    max-width: 90vw;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.info-modal-body p {
    margin: 0 0 14px 0;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
}
.info-modal-body p:last-child { margin-bottom: 0; }
.info-modal-body strong {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.info-modal-body a:hover { text-decoration: underline; }
