/*
 * Infoplakat Editor v2 - Modern Glass UI
 */

:root {
    --ip-primary: #3b82f6;
    --ip-primary-hover: #2563eb;
    --ip-success: #10b981;
    --ip-warning: #f59e0b;
    --ip-danger: #ef4444;

    /* Light Mode */
    --ip-bg-page: linear-gradient(135deg, #e0e7ff 0%, #fce7f3 50%, #dbeafe 100%);
    --ip-bg-glass: rgba(255, 255, 255, 0.7);
    --ip-bg-glass-hover: rgba(255, 255, 255, 0.85);
    --ip-bg-solid: #ffffff;
    --ip-text: #1e293b;
    --ip-text-secondary: #64748b;
    --ip-text-muted: #94a3b8;
    --ip-border: rgba(255, 255, 255, 0.5);
    --ip-border-subtle: rgba(0, 0, 0, 0.06);
    --ip-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --ip-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);

    --ip-app-padding: 16px;
    --ip-radius: 24px;
    --ip-radius-sm: 12px;
    --ip-radius-xs: 8px;
}

[data-theme="dark"] {
    --ip-bg-page: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e3a5f 100%);
    --ip-bg-glass: rgba(30, 41, 59, 0.7);
    --ip-bg-glass-hover: rgba(30, 41, 59, 0.85);
    --ip-bg-solid: #1e293b;
    --ip-text: #f1f5f9;
    --ip-text-secondary: #94a3b8;
    --ip-text-muted: #64748b;
    --ip-border: rgba(255, 255, 255, 0.1);
    --ip-border-subtle: rgba(255, 255, 255, 0.05);
    --ip-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --ip-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--ip-bg-page);
    background-attachment: fixed;
    color: var(--ip-text);
    margin: 0;
    min-height: 100vh;
    line-height: 1.5;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

/* =========================================================================
   Card System - Unified card components
   ========================================================================= */

/**
 * CARD SYSTEM
 *
 * Base:     .card                 - Glass background, border, hover effect
 *
 * Variants:
 *   .card--subtle                 - Subtle hover (1px lift)
 *   .card--flat                   - No lift, border highlight only
 *   .card--solid                  - Solid background
 *   .card--row                    - Compact row layout (12px padding)
 *   .card--rows                   - Container for .setting-row elements (no padding, overflow hidden)
 *   .card--interactive            - Cursor pointer
 *   .card--static                 - No hover effect
 *
 * Layout elements:
 *   .card-drag                    - Drag handle
 *   .card-icon                    - Icon container (44x44)
 *   .card-icon--sm                - Small icon (36x36)
 *   .card-icon--lg                - Large icon (48x48)
 *   .card-icon--round             - Round icon
 *   .card-icon--gradient          - Gradient background (use with .profile/.users/etc)
 *   .card-body                    - Main content (flex: 1)
 *   .card-title                   - Title (15px bold)
 *   .card-subtitle                - Subtitle (12px muted)
 *   .card-value                   - Large value (18px bold) for stats
 *   .card-label                   - Small label (11px muted)
 *   .card-badges                  - Badge container
 *   .card-end                     - Right side container
 *   .card-actions                 - Action buttons (opacity on hover)
 *   .card-chevron                 - Chevron arrow (animates on hover)
 *   .card-menu                    - Dropdown menu trigger
 */

/* Base Card */
.card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--ip-bg-glass);
    border: 1px solid var(--ip-border);
    border-radius: var(--ip-radius-sm);
    transition: all 0.2s ease;
}

.card:hover {
    background: var(--ip-bg-glass-hover);
    transform: translateY(-2px);
    box-shadow: var(--ip-shadow);
}

/* Subtle hover (1px lift) - recommended for lists */
.card--subtle:hover {
    transform: translateY(-1px);
    box-shadow: var(--ip-shadow-sm);
}

/* Flat hover - no lift, border highlight */
.card--flat:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--ip-primary);
}

/* Solid background */
.card--solid {
    background: var(--ip-bg-solid);
    border-color: var(--ip-border-subtle);
}

.card--solid:hover {
    background: var(--ip-bg-glass-hover);
}

/* Row layout - compact padding */
.card--row {
    padding: 12px;
    gap: 12px;
    border-radius: var(--ip-radius-xs);
}

/* Interactive (clickable) */
.card--interactive {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

/* Static - no hover */
.card--static:hover {
    transform: none;
    box-shadow: none;
    background: var(--ip-bg-glass);
}

/* Rows container - for .setting-row form elements */
.card--rows {
    display: block;
    padding: 0;
    overflow: hidden;
}

.card--rows:hover {
    transform: none;
    box-shadow: none;
}

/* Danger variant for rows */
.card--rows.card--danger .setting-row {
    background: rgba(239, 68, 68, 0.05);
}

/* Inactive - faded appearance */
.card--inactive {
    opacity: 0.5;
}

/* -------------------------
   Card Layout Elements
   ------------------------- */

/* Drag handle */
.card-drag {
    cursor: grab;
    color: var(--ip-text-muted);
    padding: 4px;
    margin: -4px;
    flex-shrink: 0;
}

.card-drag:active {
    cursor: grabbing;
}

.card-drag svg {
    width: 16px;
    height: 16px;
}

/* Icon container */
.card-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ip-bg-glass);
    border-radius: var(--ip-radius-xs);
    color: var(--ip-primary);
    flex-shrink: 0;
}

.card-icon svg,
.card-icon i {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

/* Icon sizes */
.card-icon--sm {
    width: 36px;
    height: 36px;
}

.card-icon--sm svg,
.card-icon--sm i {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.card-icon--lg {
    width: 48px;
    height: 48px;
}

.card-icon--lg svg,
.card-icon--lg i {
    width: 24px;
    height: 24px;
    font-size: 24px;
}

/* Round icon */
.card-icon--round {
    border-radius: 50%;
    border: 2px solid var(--ip-border);
}

.card-icon--round img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Gradient icon backgrounds */
.card-icon--gradient {
    color: white;
}

.card-icon--gradient.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}

.card-icon--gradient.green {
    background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
}

.card-icon--gradient.orange {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
}

.card-icon--gradient.pink {
    background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
}

.card-icon--gradient.purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
}

/* Icon color variants */
.card-icon--success {
    color: var(--ip-success);
}

/* Preview icon (screen thumbnail) */
.card-icon--preview {
    width: 48px;
    height: 36px;
    border-radius: 4px;
    color: var(--ip-text-muted);
}

/* Brand icons (size variant for integrations) */
.card-icon--brand {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

/* Connected state */
.card--connected {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.02);
}

/* Main content area */
.card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Title */
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ip-text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Subtitle */
.card-subtitle {
    font-size: 12px;
    color: var(--ip-text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Large value (for stats) */
.card-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--ip-text);
    line-height: 1.2;
}

/* Small label */
.card-label {
    font-size: 11px;
    color: var(--ip-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Badges container */
.card-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

/* Inline badge (not absolute positioned) */
.card-badges .badge,
.badge--inline {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    text-transform: none;
    background: var(--ip-bg-glass);
    color: var(--ip-text-secondary);
    border-radius: 4px;
}

.card-badges .badge svg,
.badge--inline svg {
    width: 12px;
    height: 12px;
}

.badge--muted {
    background: var(--ip-bg-glass);
    color: var(--ip-text-muted);
}

.badge--warning {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

[data-theme="dark"] .badge--warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.badge--success {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

[data-theme="dark"] .badge--success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge--danger {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

[data-theme="dark"] .badge--danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* Right side container */
.card-end {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Action buttons - visible on hover */
.card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.card:hover .card-actions {
    opacity: 1;
}

/* Always visible actions */
.card-actions--visible {
    opacity: 1;
}

/* Chevron arrow (for navigation cards) */
.card-chevron {
    color: var(--ip-text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.card-chevron svg {
    width: 20px;
    height: 20px;
}

.card:hover .card-chevron {
    transform: translateX(4px);
    color: var(--ip-primary);
}

/* Menu trigger (ellipsis dropdown) */
.card-menu {
    position: relative;
}

.card-menu-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--ip-radius-xs);
    color: var(--ip-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.card-menu-btn:hover {
    background: var(--ip-bg-glass);
    color: var(--ip-text);
}

.card-menu-btn svg {
    width: 16px;
    height: 16px;
}

/* Dropdown menu */
.card-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 160px;
    background: var(--ip-bg-solid);
    border: 1px solid var(--ip-border);
    border-radius: var(--ip-radius-xs);
    box-shadow: var(--ip-shadow);
    padding: 4px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.15s ease;
}

.card-menu.open .card-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.card-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--ip-text);
    font-size: 13px;
    text-align: left;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.card-menu-item:hover {
    background: var(--ip-bg-glass);
}

.card-menu-item--danger {
    color: var(--ip-danger);
}

.card-menu-item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.card-menu-item svg {
    width: 16px;
    height: 16px;
}

.card-menu-divider {
    height: 1px;
    background: var(--ip-border-subtle);
    margin: 4px 0;
}

/* -------------------------
   Card with sections (header/body/footer)
   For more complex cards like calendar-card
   ------------------------- */
.card--sectioned {
    flex-direction: column;
    padding: 0;
    gap: 0;
}

.card--sectioned .card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    width: 100%;
}

.card--sectioned .card-section {
    padding: 12px 16px;
    border-top: 1px solid var(--ip-border-subtle);
}

.card--sectioned .card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    padding: 10px 16px;
    border-top: 1px solid var(--ip-border-subtle);
}

/* App Layout */
.app {
    display: flex;
    min-height: 100vh;
    padding: var(--ip-app-padding);
    gap: var(--ip-app-padding);
}

/* Sidebar */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-radius: var(--ip-radius);
    background: var(--ip-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--ip-border);
    box-shadow: var(--ip-shadow);
    overflow: hidden;
}

/* =========================================================================
   Right Config Sidebar - Stack-based system at .app level

   Supports multiple stacked panels that can be pushed/popped.
   Automatically closes on route changes.
   ========================================================================= */

/* Right sidebar variant - used for config panels at .app level */
.sidebar--right {
    width: 320px;
    flex-shrink: 0;
    position: relative;
    transition: width 0.3s ease, margin 0.3s ease, opacity 0.3s ease;
}

/* Hidden state - collapses width to 0 */
.sidebar--right[hidden] {
    display: flex !important; /* Override hidden but with zero width */
    width: 0;
    margin-left: calc(-1 * var(--ip-app-padding));
    opacity: 0;
    overflow: hidden;
    border: none;
    pointer-events: none;
}

/* Stack container - holds all sidebar panels */
.config-sidebar-stack {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Individual panel in the stack */
.config-sidebar-panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--ip-bg-glass);
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}

/* Active panel (visible) */
.config-sidebar-panel.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

/* Panel behind active (dimmed) */
.config-sidebar-panel.behind {
    transform: translateX(-20%);
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

/* Hidden panel (preserveContent) - keeps DOM but invisible */
.config-sidebar-panel.hidden {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* Panel header with back button */
.config-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ip-border-subtle);
    flex-shrink: 0;
}

.config-panel-header .btn-back {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--ip-radius-xs);
    color: var(--ip-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.config-panel-header .btn-back:hover {
    background: var(--ip-bg-glass-hover);
    color: var(--ip-text);
}

.config-panel-header .btn-back svg {
    width: 18px;
    height: 18px;
}

.config-panel-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.config-panel-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--ip-radius-xs);
    color: var(--ip-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.config-panel-close:hover {
    background: var(--ip-bg-glass-hover);
    color: var(--ip-text);
}

.config-panel-close svg {
    width: 18px;
    height: 18px;
}

/* Panel content area */
.config-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Panel footer */
.config-panel-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--ip-border-subtle);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-link {
    display: flex;
    align-items: center;
}

.sidebar-logo {
    height: 28px;
    width: auto;
}

.sidebar-logo.logo-dark {
    display: none;
}

[data-theme="dark"] .sidebar-logo.logo-light {
    display: none;
}

[data-theme="dark"] .sidebar-logo.logo-dark {
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    overflow-y: auto;
}

/* Nav Group with toggle */
.nav-group {
    margin-bottom: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--ip-text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--ip-radius-sm);
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item > svg:first-child {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item > span {
    flex: 1;
}

.nav-toggle-icon {
    width: 16px;
    height: 16px;
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.nav-group.open .nav-toggle-icon {
    transform: rotate(180deg);
}

.nav-item:hover {
    background: var(--ip-bg-glass-hover);
    color: var(--ip-text);
}

.nav-item.active {
    background: var(--ip-bg-solid);
    color: var(--ip-primary);
    box-shadow: var(--ip-shadow-sm);
}

.nav-item.active > svg:first-child {
    opacity: 1;
}

/* Subitems */
.nav-subitems {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.nav-group.open .nav-subitems {
    max-height: 300px;
}

.nav-subitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 48px;
    color: var(--ip-text-secondary);
    font-size: 13px;
    border-radius: var(--ip-radius-xs);
    margin: 2px 0;
    transition: all 0.15s ease;
}

.nav-subitem:hover {
    background: var(--ip-bg-glass-hover);
    color: var(--ip-text);
}

.nav-subitem.active {
    color: var(--ip-primary);
    font-weight: 500;
}

.nav-divider {
    height: 1px;
    background: var(--ip-border-subtle);
    margin: 12px 16px;
}

.sidebar-footer {
    padding: 8px 12px 12px;
}

/* Main Area */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Panel (combined header + content) */
.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--ip-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--ip-border);
    border-radius: var(--ip-radius);
    box-shadow: var(--ip-shadow);
    overflow: hidden;
}

/* Flat panel - no box styling, content floats directly on background */
.panel--flat {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.panel-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--ip-border-subtle);
}

/* Flat panel header - no border, just spacing */
.panel--flat .panel-header {
    border-bottom: none;
    padding-bottom: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.page-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ip-text-secondary);
    padding: 4px 10px;
    background: var(--ip-bg-solid);
    border-radius: 50px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-content {
    flex: 1;
    padding: 24px;
    overflow: auto;
}

/* Icon Button */
.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--ip-radius-sm);
    color: var(--ip-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--ip-bg-glass-hover);
    color: var(--ip-text);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: opacity 0.2s, transform 0.2s;
}

.theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="dark"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0);
}

/* User Button */
.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    background: var(--ip-bg-solid);
    border: 1px solid var(--ip-border-subtle);
    border-radius: 50px;
    color: var(--ip-text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--ip-shadow-sm);
}

.user-btn:hover {
    box-shadow: var(--ip-shadow);
}

.user-btn .chevron {
    transition: transform 0.2s ease;
}

.user-menu.open .user-btn .chevron {
    transform: rotate(180deg);
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--ip-bg-solid);
    border: 1px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    box-shadow: var(--ip-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 100;
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ip-border-subtle);
}

.user-dropdown-header .name {
    font-weight: 600;
    font-size: 14px;
}

.user-dropdown-header .email {
    font-size: 12px;
    color: var(--ip-text-secondary);
}

.user-dropdown-menu {
    padding: 8px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--ip-text-secondary);
    font-size: 13px;
    border-radius: var(--ip-radius-xs);
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.user-dropdown-item:hover {
    background: var(--ip-bg-glass-hover);
    color: var(--ip-text);
}

.user-dropdown-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.user-dropdown-item.danger {
    color: var(--ip-danger);
}

.user-dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--ip-border-subtle);
    margin: 4px 0;
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--ip-primary), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 600;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--ip-bg-solid);
    border: 1px solid var(--ip-border-subtle);
    border-radius: 50px;
    color: var(--ip-text);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--ip-shadow-sm);
}

.quick-action:hover {
    box-shadow: var(--ip-shadow);
    transform: translateY(-1px);
}

.quick-action svg {
    width: 16px;
    height: 16px;
    color: var(--ip-primary);
}

/* Screen Preview Large */
.screen-preview-large {
    aspect-ratio: 16/9;
    background: var(--ip-bg-solid);
    border: 1px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: var(--ip-shadow-sm);
}

.preview-placeholder {
    text-align: center;
    color: var(--ip-text-muted);
}

.preview-placeholder svg {
    opacity: 0.3;
    margin-bottom: 8px;
}

.preview-placeholder p {
    margin: 0;
    font-size: 13px;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.info-card {
    background: var(--ip-bg-solid);
    border: 1px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    padding: 16px;
    box-shadow: var(--ip-shadow-sm);
}

.info-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ip-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.info-value {
    font-size: 14px;
    color: var(--ip-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--ip-primary), #8b5cf6);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--ip-bg-solid);
    color: var(--ip-text);
    border: 1px solid var(--ip-border-subtle);
    box-shadow: var(--ip-shadow-sm);
}

.btn-secondary:hover {
    box-shadow: var(--ip-shadow);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--ip-text-secondary);
}

.btn-ghost:hover {
    background: var(--ip-bg-glass);
    color: var(--ip-text);
}

.btn-text {
    background: none;
    border: none;
    color: var(--ip-primary);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.btn-text:hover {
    text-decoration: underline;
}

.btn-danger {
    background: var(--ip-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-danger-text {
    color: var(--ip-danger);
}

.btn-danger-text:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Icon Button - square button for icon-only actions */
.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--ip-radius-xs);
    color: var(--ip-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.btn-icon:hover {
    background: var(--ip-bg-glass-hover);
    color: var(--ip-text);
}

.btn-icon.btn-danger:hover,
.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--ip-danger);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* =========================================================================
   Forms
   ========================================================================= */

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 50px;
    transition: 0.2s;
}

[data-theme="dark"] .toggle-slider {
    background: #475569;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle input:checked + .toggle-slider {
    background: var(--ip-primary);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Form Select */
.form-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    font-size: 15px;
    border: 2px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    background: var(--ip-bg-solid);
    color: var(--ip-text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.2s;
}

.form-select:focus {
    outline: none;
    border-color: var(--ip-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Form Hint */
.form-hint {
    font-size: 12px;
    color: var(--ip-text-muted);
    margin-top: 4px;
    display: block;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 16px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--ip-border-subtle);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--ip-primary);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--ip-primary);
    border-radius: 50%;
}

.radio-text {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--ip-text);
}

/* Form Section & Input */
.form-section {
    margin-bottom: 24px;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ip-text);
    margin-bottom: 10px;
}

.form-label svg {
    width: 16px;
    height: 16px;
    color: var(--ip-text-muted);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    background: var(--ip-bg-solid);
    color: var(--ip-text);
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--ip-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
    color: var(--ip-text-muted);
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-label-sm {
    font-size: 13px;
    color: var(--ip-text-secondary);
    white-space: nowrap;
}

.form-input-sm {
    width: 100px;
    padding: 8px 12px;
    font-size: 14px;
}

/* =========================================================================
   Status Indicators
   ========================================================================= */

/**
 * STATUS INDICATORS
 *
 * Dot:    .status-dot                    - Small circular indicator (8px)
 *         .status-dot.online             - Green with glow
 *         .status-dot.offline            - Muted gray
 *
 * Badge:  .status-badge                  - Pill badge (absolute positioned)
 *         .status-badge.online           - Green background
 *         .status-badge.offline          - Gray background
 *
 * Indicator: .status-indicator           - Small dot (8px) for inline use
 *            .status-indicator.online    - Green with glow
 *            .status-indicator.offline   - Red/danger
 */

/* Status Dot - small circular indicator */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--ip-success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-dot.offline {
    background: var(--ip-text-muted);
}

/* Status Badge - pill-shaped badge */
.status-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 500;
}

.status-badge.online {
    background: rgba(16, 185, 129, 0.15);
    color: var(--ip-success);
}

.status-badge.offline {
    background: rgba(148, 163, 184, 0.15);
    color: var(--ip-text-muted);
}

/* Status Indicator - inline dot */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ip-text-muted);
}

.status-indicator.online {
    background: var(--ip-success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-indicator.offline {
    background: var(--ip-danger);
}

/* =========================================================================
   Empty States
   ========================================================================= */

/**
 * EMPTY STATES
 *
 * Default:  .empty-state          - Full empty state with icon, title, description
 * Mini:     .empty-state-mini     - Compact version for smaller containers
 */

/* Full Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 64px 24px;
    color: var(--ip-text-secondary);
}

.empty-state svg {
    margin-bottom: 16px;
    color: var(--ip-text-muted);
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--ip-text);
    margin: 0 0 8px;
}

.empty-state p {
    margin: 0 0 24px;
    max-width: 320px;
}

/* Mini Empty State - for compact spaces */
.empty-state-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 16px;
    color: var(--ip-text-muted);
}

.empty-state-mini svg {
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-state-mini p {
    margin: 0 0 12px;
    font-size: 13px;
}

/* =========================================================================
   Page Structure
   ========================================================================= */

/**
 * PAGE STRUCTURE
 *
 * Used across settings pages, dashboard, and other content pages.
 *
 * Section:     .page-section           - Section wrapper with bottom margin
 *              .page-section-title     - Section title (h3)
 *              .section-header         - Flex header with title + action
 *
 * Settings:    .setting-row            - Flex row for settings
 *              .setting-info           - Label and description container
 */

/* Page Section */
.page-section {
    margin-bottom: 24px;
}

.page-section-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--ip-text-secondary);
}

/* Section Header - title with action on right */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

/* Setting Row - for configuration options */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ip-border-subtle);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-info label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.setting-info p {
    font-size: 13px;
    color: var(--ip-text-secondary);
    margin: 0;
}

/* Info List & Item - for displaying read-only data in vertical list */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item .info-label {
    font-size: 12px;
    color: var(--ip-text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item .info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--ip-text);
}

.info-item .info-value.muted {
    color: var(--ip-text-muted);
    font-style: italic;
    font-weight: 400;
}

/* Section Header - title with action button */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h3 {
    margin: 0;
}

/* Card block variant - override flex for content blocks */
.card--block {
    display: block;
    padding: 20px;
}

.card--block:hover {
    transform: none;
    box-shadow: none;
}

@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   Animations & Utilities
   ========================================================================= */

/* Spinner Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar collapsed state (desktop) */
.sidebar {
    transition: width 0.3s ease, padding 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}

.app.sidebar-collapsed .sidebar {
    width: 0;
    padding: 0;
    margin-right: calc(-1 * var(--ip-app-padding));
    opacity: 0;
    overflow: hidden;
    border: none;
}

/* Responsive */
@media (max-width: 768px) {
    .app {
        padding: 12px;
    }

    .sidebar {
        position: fixed;
        top: 12px;
        left: 12px;
        right: 12px;
        width: auto;
        max-height: calc(100vh - 24px);
        z-index: 100;
        transform: translateY(-120%);
    }

    .sidebar.open {
        transform: translateY(0);
    }

    .app.sidebar-collapsed .sidebar {
        transform: translateY(-120%);
    }

    .app.sidebar-collapsed .sidebar.open {
        transform: translateY(0);
    }

    .user-name {
        display: none;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        flex-wrap: wrap;
    }
}

/* =========================================================================
   Toast Notifications
   ========================================================================= */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--ip-bg-solid);
    border: 1px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    box-shadow: var(--ip-shadow);
    min-width: 300px;
    max-width: 400px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

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

.toast-icon {
    flex-shrink: 0;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
}

.toast-success .toast-icon { color: var(--ip-success); }
.toast-error .toast-icon { color: var(--ip-danger); }
.toast-warning .toast-icon { color: var(--ip-warning); }
.toast-info .toast-icon { color: var(--ip-primary); }

.toast-content {
    flex: 1;
    font-size: 13px;
}

.toast-content strong {
    display: block;
    margin-bottom: 2px;
}

.toast-content p {
    margin: 0;
    color: var(--ip-text-secondary);
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--ip-text-muted);
    cursor: pointer;
    padding: 0;
}

.toast-close svg {
    width: 16px;
    height: 16px;
}

/* Note: Screen Cards styles moved to screens.jsr */
/* Note: Dashboard Home styles moved to home.jsr */
/* Note: Screen Editor styles moved to screen-editor.jsr */

/* Error Page */
.error-page {
    text-align: center;
    padding: 48px;
}

.error-page h2 {
    font-size: 24px;
    margin: 0 0 8px;
}

.error-page p {
    color: var(--ip-text-secondary);
    margin: 0 0 24px;
}

/* =========================================================================
   Modal
   ========================================================================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--ip-bg-solid);
    border-radius: var(--ip-radius);
    box-shadow: var(--ip-shadow);
    z-index: 201;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.modal.modal-lg {
    max-width: 700px;
}

.modal.show,
.modal.show ~ .modal-backdrop {
    opacity: 1;
}

.modal.show {
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ip-border-subtle);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--ip-border-subtle);
}

/* Modal with dialog wrapper (Bootstrap-style structure) */
.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    z-index: 201;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.modal-dialog.modal-sm {
    max-width: 400px;
}

.modal-dialog.modal-lg {
    max-width: 700px;
}

.modal.show .modal-dialog {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-content {
    background: var(--ip-bg-solid);
    border-radius: var(--ip-radius);
    box-shadow: var(--ip-shadow);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* Close button for modals */
.btn-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--ip-text-muted);
    cursor: pointer;
    border-radius: var(--ip-radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-close:hover {
    background: var(--ip-bg-glass);
    color: var(--ip-text);
}

.btn-close svg {
    width: 18px;
    height: 18px;
}

/* -------------------------------------------------------------------------
   Modal Styled Variant (.modal--styled)

   Modern modal design with icon header. Use for feature-specific modals.
   Apply page-specific icon gradient via inline <style> in template.

   Structure:
   <div class="modal modal--styled">
     <div class="modal-header">
       <div class="modal-header-content">
         <div class="modal-icon"><i data-lucide="..."></i></div>
         <div>
           <h3 class="modal-title">Title</h3>
           <p class="modal-subtitle">Description</p>
         </div>
       </div>
       <button class="btn-close">...</button>
     </div>
     <div class="modal-body">...</div>
     <div class="modal-footer">...</div>
   </div>
   ------------------------------------------------------------------------- */
.modal--styled {
    max-width: 480px;
}

.modal--styled .modal-header {
    padding: 24px 24px 16px;
    border-bottom: none;
}

.modal--styled .modal-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.modal--styled .modal-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ip-primary), #8b5cf6);
    border-radius: 12px;
    color: white;
}

.modal--styled .modal-icon svg {
    width: 24px;
    height: 24px;
}

.modal--styled .modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal--styled .modal-subtitle {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--ip-text-muted);
}

.modal--styled .btn-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--ip-text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal--styled .btn-close:hover {
    background: var(--ip-bg-glass);
    color: var(--ip-text);
}

.modal--styled .btn-close svg {
    width: 18px;
    height: 18px;
}

.modal--styled .modal-body {
    padding: 8px 24px 24px;
}

.modal--styled .modal-footer {
    padding: 16px 24px 24px;
    border-top: none;
    gap: 12px;
}

/* Slide Type Grid */
.slide-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.slide-type-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--ip-bg-glass);
    border: 1px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.slide-type-item:hover {
    background: var(--ip-bg-glass-hover);
    border-color: var(--ip-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.slide-type-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ip-bg-solid);
    border-radius: var(--ip-radius-xs);
    color: var(--ip-primary);
    flex-shrink: 0;
}

.slide-type-icon i,
.slide-type-icon svg {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.slide-type-info {
    flex: 1;
    min-width: 0;
}

.slide-type-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
}

.slide-type-desc {
    font-size: 12px;
    color: var(--ip-text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    position: absolute;
    top: 8px;
    right: 8px;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--ip-warning);
}

/* New Screen Button in Sidebar */
.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 8px;
}

.nav-section-header .label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ip-text-muted);
}

.btn-add-screen {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--ip-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-screen:hover {
    background: var(--ip-bg-glass-hover);
    color: var(--ip-primary);
}

.btn-add-screen svg {
    width: 16px;
    height: 16px;
}

/* Nav Item Wrapper (for inline add button) */
.nav-item-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-item-wrapper .nav-item {
    flex: 1;
}

.nav-item-wrapper .btn-add-screen {
    margin-right: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-group:hover .nav-item-wrapper .btn-add-screen,
.nav-item-wrapper .btn-add-screen:focus {
    opacity: 1;
}

/* Note: Screen Dashboard styles moved to screen-dashboard.jsr */
/* Note: Form section/label/input styles are in Forms section above */

/* Orientation Cards */
.orientation-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.orientation-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 16px;
    border: 2px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    background: var(--ip-bg-solid);
    cursor: pointer;
    transition: all 0.2s;
}

.orientation-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.orientation-card:hover {
    border-color: var(--ip-primary);
    background: var(--ip-bg-glass-hover);
}

.orientation-card.selected {
    border-color: var(--ip-primary);
    background: rgba(59, 130, 246, 0.05);
}

.orientation-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.orientation-preview .preview-screen {
    background: linear-gradient(135deg, #e0e7ff, #dbeafe);
    border: 2px solid var(--ip-border-subtle);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.orientation-preview.landscape .preview-screen {
    width: 80px;
    height: 50px;
}

.orientation-preview.portrait .preview-screen {
    width: 50px;
    height: 80px;
}

.orientation-preview .preview-content {
    width: 100%;
    height: 100%;
    background: var(--ip-bg-glass);
    border-radius: 2px;
}

.orientation-card.selected .preview-screen {
    border-color: var(--ip-primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
}

.orientation-info {
    text-align: center;
}

.orientation-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--ip-text);
}

.orientation-desc {
    display: block;
    font-size: 11px;
    color: var(--ip-text-muted);
    margin-top: 2px;
}

.orientation-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ip-primary);
    border-radius: 50%;
    color: white;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s;
}

.orientation-check svg {
    width: 12px;
    height: 12px;
}

.orientation-card.selected .orientation-check {
    opacity: 1;
    transform: scale(1);
}

/* Optional Fields Toggle */
.form-section-collapsed {
    border-top: 1px solid var(--ip-border-subtle);
    padding-top: 16px;
    margin-top: 8px;
}

.form-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 0;
    border: none;
    background: transparent;
    color: var(--ip-text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
}

.form-toggle:hover {
    color: var(--ip-text);
}

.form-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.form-toggle.open svg {
    transform: rotate(180deg);
}

.optional-fields {
    padding-top: 16px;
}

.optional-fields[hidden] {
    display: none;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-label-sm {
    font-size: 13px;
    color: var(--ip-text-secondary);
    white-space: nowrap;
}

.form-input-sm {
    width: 100px;
    padding: 8px 12px;
    font-size: 14px;
}

/* Calendar Type Cards */
.calendar-type-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.calendar-type-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid var(--ip-border);
    border-radius: var(--ip-radius-xs);
    background: var(--ip-bg-solid);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.calendar-type-card:hover {
    border-color: var(--ip-primary);
    background: var(--ip-bg-glass-hover);
}

.calendar-type-card.selected {
    border-color: var(--ip-primary);
    background: rgba(59, 130, 246, 0.05);
}

.calendar-type-card input[type="radio"] {
    display: none;
}

.calendar-type-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ip-bg-glass);
    border-radius: 8px;
    color: var(--ip-primary);
    flex-shrink: 0;
}

.calendar-type-icon.microsoft {
    color: #00a4ef;
}

.calendar-type-icon.google {
    color: #4285f4;
}

.calendar-type-icon svg {
    width: 18px;
    height: 18px;
}

.calendar-type-info {
    flex: 1;
    min-width: 0;
}

.calendar-type-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--ip-text);
}

.calendar-type-desc {
    display: block;
    font-size: 12px;
    color: var(--ip-text-muted);
    margin-top: 1px;
}

.calendar-type-check {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ip-primary);
    border-radius: 50%;
    color: white;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s;
}

.calendar-type-check svg {
    width: 12px;
    height: 12px;
}

.calendar-type-card.selected .calendar-type-check {
    opacity: 1;
    transform: scale(1);
}

/* Calendar Form */
.calendar-form {
    animation: fadeIn 0.2s ease;
}

.calendar-form .form-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--ip-text-muted);
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 8px;
}

.color-option {
    cursor: pointer;
}

.color-option input[type="radio"] {
    display: none;
}

.color-swatch {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color);
    border: 3px solid transparent;
    transition: all 0.2s;
}

.color-option:hover .color-swatch {
    transform: scale(1.1);
}

.color-option input:checked + .color-swatch {
    border-color: var(--ip-bg-solid);
    box-shadow: 0 0 0 2px var(--color);
}

/* OAuth Info */
.calendar-oauth-info {
    padding: 20px;
    background: var(--ip-bg-glass);
    border-radius: var(--ip-radius-xs);
    text-align: center;
}

.oauth-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--ip-text-secondary);
}

.oauth-message svg {
    width: 32px;
    height: 32px;
    color: var(--ip-primary);
}

.oauth-message p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   Reusable Components (Search, Filter, etc.)
   ========================================================================= */

/**
 * SEARCH BOX
 *
 * Container: .search-box           - Relative positioned flex container
 *
 * Input variants:
 *   .search-box input              - Pill shape (50px radius), 200px width
 *   .search-input                  - Rounded rectangle (12px radius), 240px width
 *
 * Usage:
 *   <div class="search-box">
 *       <i data-lucide="search"></i>
 *       <input type="text" placeholder="Søk...">           <!-- pill -->
 *       <input type="text" class="search-input" ...>       <!-- rounded -->
 *   </div>
 */

/* Search Box Container */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box > svg,
.search-box > i {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--ip-text-muted);
    pointer-events: none;
}

/* Pill-shaped input (default) */
.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--ip-border-subtle);
    border-radius: 50px;
    background: var(--ip-bg-solid);
    color: var(--ip-text);
    font-size: 13px;
    width: 200px;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--ip-primary);
}

.search-box input::placeholder {
    color: var(--ip-text-muted);
}

/* Rounded rectangle input (alternative) */
.search-input {
    width: 240px;
    padding: 8px 12px 8px 36px;
    font-size: 14px;
    border: 1px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    background: var(--ip-bg-solid);
    color: var(--ip-text);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--ip-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input::placeholder {
    color: var(--ip-text-muted);
}

/* Filter Dropdown */
.filter-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    min-width: 180px;
    margin-top: 4px;
    padding: 8px 0;
    background: var(--ip-bg-solid);
    border: 1px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    box-shadow: var(--ip-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s;
}

.filter-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--ip-text);
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: var(--ip-bg-glass);
}

.dropdown-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--ip-primary);
}

.dropdown-item i {
    width: 16px;
    font-size: 14px;
}

/* Load More */
.load-more {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

/* Back Link - navigation link with arrow */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--ip-text-secondary);
    margin-bottom: 12px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--ip-primary);
}

.back-link svg {
    width: 16px;
    height: 16px;
}

/* Mobile: Full width search */
@media (max-width: 768px) {
    .search-input {
        width: 100%;
    }
}

/* =========================================================================
   Settings Subpages
   ========================================================================= */
.settings-subpage {
    max-width: 700px;
}

.settings-subpage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
}

.settings-subpage-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.settings-subpage-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.settings-subpage-title-row h2 {
    margin: 0;
}

/* Settings Danger Zone */
.settings-danger-zone h3 {
    color: var(--ip-danger);
}

/* Mobile adjustments for settings */
@media (max-width: 768px) {
    .settings-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   Customer Switcher
   ========================================================================= */
.customer-switcher {
    padding: 12px 16px;
    margin: 8px 12px;
    position: relative;
}

.customer-switcher-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--ip-bg-glass);
    border: 1px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-xs);
    color: var(--ip-text);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    text-align: left;
}

.customer-switcher-btn:hover {
    background: var(--ip-bg-glass-hover);
    border-color: var(--ip-primary);
}

.customer-switcher-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.customer-switcher-btn svg:first-child {
    color: var(--ip-primary);
}

.customer-switcher-btn .customer-name {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-switcher-btn .customer-chevron {
    width: 16px;
    height: 16px;
    color: var(--ip-text-muted);
    transition: transform 0.2s;
}

.customer-switcher.open .customer-chevron {
    transform: rotate(180deg);
}

.customer-switcher-dropdown {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 12px;
    right: 12px;
    background: var(--ip-bg-solid);
    border: 1px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    box-shadow: var(--ip-shadow);
    z-index: 100;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.customer-switcher.open .customer-switcher-dropdown {
    display: block;
}

.customer-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--ip-text);
    font-size: 13px;
}

.customer-dropdown-item:hover {
    background: var(--ip-bg-glass-hover);
}

.customer-dropdown-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--ip-primary);
}

.customer-dropdown-item svg {
    width: 16px;
    height: 16px;
    color: var(--ip-text-muted);
}

.customer-dropdown-item.active svg {
    color: var(--ip-primary);
}

.customer-dropdown-item .customer-item-name {
    flex: 1;
}

.customer-dropdown-item .customer-item-role {
    font-size: 11px;
    color: var(--ip-text-muted);
    text-transform: capitalize;
}

.customer-dropdown-header {
    padding: 10px 14px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ip-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--ip-border-subtle);
}

/* ========================================
   Media Browser & Media Picker
   ======================================== */

/* Shared Media Item styling (used in /media page and MediaPicker modal) */
.media-item {
    background: var(--ip-bg-solid);
    border: 1px solid var(--ip-border-subtle);
    border-radius: var(--ip-radius-xs);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.media-item:hover {
    border-color: var(--ip-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.media-item.selected {
    border-color: var(--ip-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.media-thumb {
    aspect-ratio: 1;
    background: var(--ip-bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumb svg {
    width: 32px;
    height: 32px;
    color: var(--ip-text-muted);
}

.media-info {
    padding: 8px 10px;
}

.media-name {
    display: block;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-size {
    font-size: 11px;
    color: var(--ip-text-muted);
}

/* Folder items */
.media-item.folder {
    text-decoration: none;
    color: inherit;
}

.media-item.folder .folder-thumb {
    background: var(--ip-bg-glass);
}

.media-item.folder .folder-thumb svg {
    width: 40px;
    height: 40px;
    color: var(--ip-primary);
}

.media-item.folder:hover .folder-thumb svg {
    color: var(--ip-primary-hover);
}

/* Media empty state */
.media-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px;
    color: var(--ip-text-muted);
}

.media-empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.media-empty h3 {
    margin: 0 0 8px;
    font-weight: 600;
}

.media-empty p {
    margin: 0;
    opacity: 0.8;
}

/* Media Picker Modal */
.media-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.media-picker-overlay.open {
    opacity: 1;
    visibility: visible;
}

.media-picker-modal {
    background: var(--ip-bg-solid);
    border-radius: var(--ip-radius-lg);
    width: 800px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.media-picker-overlay.open .media-picker-modal {
    transform: scale(1);
}

.media-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ip-border-subtle);
}

.media-picker-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.media-picker-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--ip-border-subtle);
    background: var(--ip-bg-glass);
}

.media-picker-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.mp-crumb {
    color: var(--ip-text-muted);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--ip-radius-xs);
    transition: all 0.15s ease;
}

.mp-crumb:hover {
    background: var(--ip-bg-glass-hover);
    color: var(--ip-primary);
}

.mp-crumb svg {
    width: 14px;
    height: 14px;
}

.mp-crumb-sep {
    color: var(--ip-text-muted);
    opacity: 0.5;
}

.media-picker-upload-zone {
    margin: 12px 20px;
    padding: 24px;
    border: 2px dashed var(--ip-border-subtle);
    border-radius: var(--ip-radius-sm);
    text-align: center;
    color: var(--ip-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.media-picker-upload-zone:hover,
.media-picker-upload-zone.dragover {
    border-color: var(--ip-primary);
    background: rgba(59, 130, 246, 0.05);
}

.media-picker-upload-zone svg {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
}

.media-picker-upload-zone input {
    display: none;
}

.media-picker-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    align-content: start;
}

.media-picker-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--ip-text-muted);
}

.media-picker-loading svg {
    width: 24px;
    height: 24px;
    margin-bottom: 8px;
}

.media-picker-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid var(--ip-border-subtle);
    background: var(--ip-bg-glass);
}

.media-picker-selected {
    font-size: 13px;
    color: var(--ip-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.media-picker-selected.has-selection {
    color: var(--ip-text);
}

.media-picker-buttons {
    display: flex;
    gap: 8px;
}

/* Media Picker items */
.mp-item {
    aspect-ratio: 1;
    background: var(--ip-bg-glass);
    border: 2px solid transparent;
    border-radius: var(--ip-radius-xs);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mp-item:hover {
    border-color: var(--ip-border-subtle);
}

.mp-item.selected {
    border-color: var(--ip-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.mp-item.folder {
    background: transparent;
}

.mp-item.folder svg {
    width: 32px;
    height: 32px;
    color: var(--ip-primary);
    margin-bottom: 4px;
}

.mp-item.folder span {
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.mp-item.file.has-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mp-item.file .mp-icon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mp-item.file .mp-icon svg {
    width: 28px;
    height: 28px;
    color: var(--ip-text-muted);
}

.mp-item.file .mp-name {
    width: 100%;
    padding: 4px 6px;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    color: white;
}

.mp-item.file.has-thumb {
    position: relative;
}

.mp-item.file.has-thumb .mp-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.mp-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--ip-text-muted);
}

.mp-empty svg {
    width: 40px;
    height: 40px;
    opacity: 0.3;
    margin-bottom: 8px;
}

/* Spin animation for loading indicators */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

