/* Light Mode Colors */
:root {
    /* Primary backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f7f5;
    --surface: #ffffff;
    --surface-secondary: #faf9f7;

    /* Text colors */
    --text-primary: #1a1917;
    --text-secondary: #6b6864;
    --text-tertiary: #9c9894;

    /* Borders */
    --border-subtle: #e5e3df;
    --border-normal: #d4cfc8;

    /* Shadows */
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* Accent colors */
    --accent-blue: #185fa5;
    --accent-blue-light: #e3f0ff;
    --accent-blue-dark: #0a3d6f;

    --accent-teal: #0f6e56;
    --accent-teal-light: #e0f2ed;
    --accent-teal-dark: #05463a;

    /* Status colors */
    --status-success: #0f6e56;
    --status-error: #d32f2f;
    --status-warning: #f57c00;
    --status-info: #185fa5;

    /* Component colors */
    --disabled-bg: #f0ebe5;
    --disabled-text: #b5b0a8;
}

/* Font Family */
:root {
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

/* Typography Scale */
:root {
    /* Hero Title - 42px */
    --fs-hero: 42px;
    --lh-hero: 1.2;
    --fw-hero: 500;

    /* Section Heading - 24px */
    --fs-h1: 24px;
    --lh-h1: 1.3;
    --fw-h1: 500;

    /* Subheading - 16px */
    --fs-h2: 16px;
    --lh-h2: 1.4;
    --fw-h2: 500;

    /* Body - 14px */
    --fs-body: 14px;
    --lh-body: 1.5;
    --fw-body: 400;

    /* Small - 12px */
    --fs-small: 12px;
    --lh-small: 1.4;
    --fw-small: 400;

    /* Tiny - 11px */
    --fs-tiny: 11px;
    --lh-tiny: 1.3;
    --fw-tiny: 400;
}

/* Font Weights - only 400 and 500 */
:root {
    --fw-regular: 400;
    --fw-medium: 500;
}

/* Spacing Scale */
:root {
    /* Base units */
    --sp-2xs: 4px;
    --sp-xs: 8px;
    --sp-sm: 12px;
    --sp-md: 16px;
    --sp-lg: 24px;
    --sp-xl: 32px;
    --sp-2xl: 48px;
    --sp-3xl: 25px;

    /* Common combinations */
    --p-sm: var(--sp-sm);
    --p-md: var(--sp-md);
    --p-lg: var(--sp-lg);

    --m-sm: var(--sp-sm);
    --m-md: var(--sp-md);
    --m-lg: var(--sp-lg);

    /* Gap for flex/grid */
    --gap-sm: var(--sp-sm);
    --gap-md: var(--sp-md);
    --gap-lg: var(--sp-lg);
}

/* Rounded Corners */
:root {
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
}

/* Theme-aware variables */

/* Additional theme-specific utilities */
:root {
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;

    /* Z-index scale */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 2000;
    --z-fixed: 300;
    --z-modal: 1000;
    --z-tooltip: 1100;
    --z-notification: 1200;
}

/* CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    font-weight: var(--fw-regular);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

p {
    margin: 0;
}

button {
    font-family: var(--font-family);
    cursor: pointer;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-normal);
    border-radius: var(--radius-md);
}

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

/* Focus visible styles */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background-color: var(--accent-blue-light);
    color: var(--text-primary);
}

::-moz-selection {
    background-color: var(--accent-blue-light);
    color: var(--text-primary);
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: var(--sp-2xl);
    text-align: center;
}

.loading-container p {
    font-size: var(--fs-body);
    color: var(--text-secondary);
}

/* Main layout flex structure */
.app> :nth-child(1) {
    /* Header */
    order: 1;
}

.app> :nth-child(2) {
    /* Hero */
    order: 2;
}

.app> :nth-child(3) {
    /* EditorWorkspace or loading */
    order: 3;
    flex: 1;
}

.app> :last-child {
    /* Footer */
    order: 4;
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .app {
        min-height: 100vh;
    }
}

.header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
    margin: 0 auto;
    padding: var(--sp-md) var(--sp-lg);
    height: 50px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--sp-xl);
}

.logo-icon {
    width: 26px;
    height: 26px;
}

.social-link {
    color: #000;
    text-decoration: none;
    width: 18px;
    height: 18px;
}

.header-nav {
    display: flex;
    gap: var(--sp-lg);
}

.nav-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: var(--fs-body);
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: var(--sp-xs);
}

.header-logo .logo-text {
    font-weight: var(--fw-medium);
    font-size: var(--fs-small);
}

.header-logo .logo-text .brand {
    font-size: var(--fs-body);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .header-container {
        padding: var(--sp-md);
    }

    .header-left {
        gap: var(--sp-lg);
    }

    .header-nav {
        gap: var(--sp-md);
    }
}

.hero {
    background-color: var(--bg-secondary);
    padding: var(--sp-lg);
}

.hero-container {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.hero-title {
    line-height: var(--lh-hero);
    font-weight: var(--fw-hero);
    color: var(--color-sf-info-bg-color);
    margin-bottom: var(--sp-sm);
}

.hero-subtitle {
    line-height: var(--lh-h2);
    color: var(--text-secondary);
    /* margin-bottom: var(--sp-sm); */
}

/* Mobile responsive */
@media (max-width: 768px) {
    .hero {
        padding: var(--sp-2xl) var(--sp-md);
    }

    .hero-title {
        font-size: 32px;
        margin-bottom: var(--sp-md);
    }

    .hero-subtitle {
        font-size: var(--fs-h2);
        margin-bottom: var(--sp-xl);
    }

    .demo-intro {
        padding: var(--sp-md);
    }
}

.editor-workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    background-color: var(--bg-secondary);
    margin: 0;
    overflow: hidden;
    position: relative;
    padding: var(--sp-lg);
    padding-top: 0;
}

.editor-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    background-color: transparent;
    overflow: hidden;
    margin: 0 auto;
    width: calc(80% - 2 * var(--sp-lg));
    max-width: 1200px;
}

.toolbar-area {
    flex-shrink: 0;
    padding: 0;
    display: flex;
    justify-content: center;
}

.editor-toolbar {
    width: 100% !important;
    max-width: 1200px;
    border: 1px solid var(--border-subtle);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background-color: var(--surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.editor-toolbar .e-toolbar-items {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-md);
    width: 100%;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    margin-left: auto;
}

.editor-area {
    flex: 1;
    /* overflow: auto; */
    min-height: 500px;
    padding: var(--sp-lg);
    background-color: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.export-button {
    transition: background-color 0.2s ease-in-out;
}

.panel-toggle-dropdown {
    transition: background-color 0.2s ease-in-out;
}

.collaboration-toolbar-wrapper {
    /* padding: 0 0 var(--sp-md) 0; */
    display: flex;
    justify-content: center;
}

.toolbar-section-left,
.toolbar-section-right {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
}

/* Scrollbar styling */
.editor-area::-webkit-scrollbar {
    width: 8px;
}

.editor-area::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.editor-area::-webkit-scrollbar-thumb {
    background: var(--border-normal);
    border-radius: var(--radius-md);
}

.editor-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Mobile responsive */
@media (max-width: 768px) {

    .editor-container {
        width: calc(100% - 2 * var(--sp-lg));
    }

    .editor-toolbar {
        padding: var(--sp-md);
        flex-wrap: wrap;
        height: auto;
    }

    .editor-area {
        min-height: 300px;
        padding: var(--sp-md);
    }
}

.toolbar-label {
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin: 0;
    white-space: nowrap;
}

.room-url-container {
    display: flex;
    gap: var(--sp-xs);
    align-items: center;
}

.room-url-container input {
    background-color: #f6f6f6 !important;
}

/* Mobile responsive */
@media (max-width: 1024px) {
    .room-url-container {
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    .room-url-container {
        min-width: 100%;
    }
}

.connection-status {
    display: flex;
    align-items: center;
    gap: var(--sp-xs);
    padding: 0 var(--sp-md);
    font-size: var(--fs-tiny);
    color: var(--text-secondary);
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background-color: var(--status-success);
    animation: pulse 1.5s infinite;
}

.status-indicator.disconnected {
    background-color: var(--status-warning);
    animation: none;
}

@keyframes pulse {

    0%,
    50%,
    100% {
        opacity: 1;
    }

    25%,
    75% {
        opacity: 0.3;
    }
}

.status-text {
    font-weight: var(--fw-medium);
}

/* ============================================
   SYNCFUSION SIDEBAR CONTAINER
   ============================================ */
.syncfusion-sidebar {
    background-color: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   SIDEBAR CONTENT WRAPPER
   ============================================ */
.sidebar-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* ============================================
   UNIFIED HEADER (Both modes)
   ============================================ */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-md) var(--sp-lg);
    border-bottom: 1px solid var(--border-subtle);
    gap: var(--sp-md);
    flex-shrink: 0;
}

.sidebar-title {
    margin: 0;
    font-size: var(--fs-body);
    font-weight: var(--fw-medium);
    color: var(--text-primary);
    flex: 1;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
}

/* ============================================
   SIDEBAR CONTENT AREA
   Container for ListView components
   ============================================ */
.sidebar-content {
    flex: 1;
    overflow: hidden;
    background-color: transparent;
}

/* ListView container inherits scrolling */
.sidebar-content .e-listview {
    height: 100%;
    overflow-y: auto;
}

/* Custom scrollbar for ListViews */
.sidebar-content .e-listview::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content .e-listview::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content .e-listview::-webkit-scrollbar-thumb {
    background: var(--border-normal);
    border-radius: var(--radius-md);
}

.sidebar-content .e-listview::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ============================================
   COLLABORATORS LIST
   ============================================ */
.collab-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    height: 100%;
    background-color: transparent;
    overflow: hidden;
}

/* ============================================
   COLLABORATORS LIST
   ============================================ */
.collaborators-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

.collaborator-item {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    padding: var(--sp-md);
    border-radius: 0;
    transition: background-color var(--transition-fast);
}

.collaborator-item:hover {
    background-color: var(--surface-secondary);
}

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

.collaborator-name {
    font-size: var(--fs-body);
    font-weight: var(--fw-medium);
    color: var(--text-primary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    color: var(--text-tertiary);
    padding: var(--sp-lg);
    font-size: var(--fs-small);
}

/* ============================================
   SYNCFUSION LISTVIEW - VERSION HISTORY
   ============================================ */

/* ListView container */
#version-history-list.e-listview {
    border: none;
    background-color: transparent;
}

#version-history-list {
    height: 100%;
}

#version-history-list.e-control.e-listview {
    padding: 0;
}

/* Group header styling */
#version-history-list.e-listview .e-list-group-item {
    padding: 20px;
    display: flex;
    align-items: center;
}

/* Version item wrapper */
.version-item-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-md);
    width: 100%;
}

/* Version content (label + meta) */
.version-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-xs);
}

/* Version label styling */
.version-label {
    font-size: var(--fs-body);
    font-weight: var(--fw-medium);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--sp-xs);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Auto label badge */
.auto-badge {
    font-size: var(--fs-small);
    font-weight: var(--fw-regular);
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* Version metadata */
.version-meta {
    font-size: var(--fs-small);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Version actions (dropdown menu) */
.version-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-xs);
    flex-shrink: 0;
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */

.e-listview-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: var(--sp-lg);
}

.e-listview-empty {
    text-align: center;
    color: var(--text-tertiary);
    padding: var(--sp-lg);
    font-size: var(--fs-small);
}

.empty-message {
    margin: 0;
    color: var(--text-secondary);
}

.rename-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.rename-dialog {
    width: 250px;
    max-width: calc(100vw - 32px);
    background: var(--surface, #fff);
    border-radius: 12px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.rename-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.rename-dialog-header span {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.rename-dialog-body {
    padding: 20px;
}

.rename-input-field {
    width: 100%;
}

.rename-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

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

