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

:root {
    /* Black and white color scheme */
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f5;
    --bg-accent: #f0f0f0;
    --text-primary: #000000;
    --text-secondary: #404040;
    --text-muted: #707070;
    --text-disabled: #a0a0a0;
    --border-light: #f0f0f0;
    --border-medium: #e0e0e0;
    --border-dark: #d0d0d0;
    --accent-primary: #000000;
    --accent-secondary: #303030;
    --accent-green: #000000;
    --accent-green-dark: #000000;
    --shadow-light: rgba(0,0,0,0.02);
    --shadow-medium: rgba(0,0,0,0.03);
    --shadow-dark: rgba(0,0,0,0.05);
    --border-radius: 4px;
    --card-spacing: 24px;
}

[data-theme="dark"] {
    /* Dark mode - inverted black and white */
    --bg-primary: #0a0a0a;
    --bg-secondary: #151515;
    --bg-tertiary: #1a1a1a;
    --bg-accent: #202020;
    --text-primary: #ffffff;
    --text-secondary: #d0d0d0;
    --text-muted: #909090;
    --text-disabled: #606060;
    --border-light: #202020;
    --border-medium: #303030;
    --border-dark: #404040;
    --accent-primary: #ffffff;
    --accent-secondary: #d0d0d0;
    --accent-green: #ffffff;
    --accent-green-dark: #ffffff;
    --shadow-light: rgba(0,0,0,0.3);
    --shadow-medium: rgba(0,0,0,0.4);
    --shadow-dark: rgba(0,0,0,0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Login Styles */
.login-body {
    background: #000000;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    max-width: 420px;
    width: 100%;
    margin: 0 20px;
    background: white;
    padding: 48px;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 15px;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 16px 20px;
    border: 1px solid var(--border-medium);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    font-size: 15px;
    transition: all 0.2s;
    background: var(--bg-primary);
}

.login-form input:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: none;
    background: white;
}

/* Header */
.header {
    background: var(--bg-secondary);
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px var(--shadow-light);
    position: relative;
}

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

.header-profile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.header-profile:hover,
.header-profile--active {
    background: var(--bg-tertiary);
    border-color: #000000;
    color: var(--text-primary);
}

.header-profile__avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: linear-gradient(135deg, #000000 0%, #000000 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.header-profile__label {
    letter-spacing: 0.02em;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-accent {
    width: 5px;
    height: 22px;
    background: #000000;
    border-radius: 3px;
}

.header-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-left: 2px;
    font-weight: 500;
}

/* Dark mode toggle */
.theme-toggle {
    background: var(--bg-accent);
    border: 1px solid var(--border-medium);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 16px;
}

.theme-toggle:hover {
    background: var(--border-medium);
    color: var(--text-secondary);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

/* Layout */
.container {
    display: flex;
    min-height: calc(100vh - 73px);
}

.sidebar {
    width: 380px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-medium);
    overflow-y: auto;
}

.main {
    flex: 1;
    padding: 32px;
    background: var(--bg-secondary);
}

/* Breadcrumb */
.breadcrumb {
    background: var(--bg-secondary);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumb a {
    color: #000000;
    text-decoration: none;
    font-weight: 600;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Creation Section */
.creation-section {
    padding: 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    margin: 16px;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 2px var(--shadow-light);
    border: 1px solid #ece8df;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.creation-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-accent);
    border-radius: 4px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
    text-align: center;
}

.tab-btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 1px 2px var(--shadow-light);
}

.creation-form {
    display: none;
}

.creation-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    font-size: 15px;
    transition: all 0.2s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-input:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.form-btn {
    background: linear-gradient(135deg, #000000 0%, #000000 100%);
    color: white;
    padding: 14px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    width: 100%;
    transition: transform 0.2s;
}

.form-btn:hover {
    transform: translateY(-2px);
}

.form-help {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Content List */
.content-list {
    padding: 0;
}

.content-section {
    margin-bottom: 32px;
}

.content-section-header {
    padding: 20px 24px 12px;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.content-group {
    background: var(--bg-secondary);
    margin: 0 16px;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 2px var(--shadow-light);
    overflow: hidden;
    border: 1px solid #ece8df;
}

.content-item {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s;
    position: relative;
    border-bottom: 1px solid var(--border-light);
}

.content-item:last-child {
    border-bottom: none;
}

.content-item:hover {
    background: var(--bg-accent);
    color: var(--text-primary);
    transform: translateX(3px);
}

.content-item-icon {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    transition: all 0.2s;
}

.content-item-icon.page {
    background: #e5e5e5;
    color: #202020;
}

.content-item-icon.blog {
    background: #e5e5e5;
    color: #202020;
}

.content-item-icon.article {
    background: #e5e5e5;
    color: #202020;
}

.content-item-icon.template {
    background: #e5e5e5;
    color: #202020;
}

.content-item:hover .content-item-icon {
    transform: scale(1.05);
}

.content-item-text {
    flex: 1;
}

.content-item-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.content-item-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.content-item-arrow {
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--text-disabled);
    font-weight: 600;
}

.content-item:hover .content-item-arrow {
    opacity: 1;
}

/* Template Sections */
.template-section {
    border-bottom: 1px solid var(--border-light);
}

.template-section:last-child {
    border-bottom: none;
}

.template-header {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    background: var(--bg-accent);
    border-bottom: 1px solid var(--border-light);
}

.template-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-left: 16px;
}

.template-file {
    display: flex;
    align-items: center;
    padding: 12px 20px 12px 76px;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.2s;
}

.template-file:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.file-icon {
    margin-right: 12px;
    color: var(--text-disabled);
}

.file-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-secondary);
}

.file-type {
    font-size: 12px;
    color: var(--text-disabled);
    background: var(--bg-accent);
    padding: 2px 8px;
    border-radius: var(--border-radius);
    font-weight: 600;
}

/* Empty State */
.empty-state {
    padding: 32px 20px;
    text-align: center;
    color: var(--text-disabled);
    font-style: italic;
    font-size: 14px;
}

/* Editor */
.editor-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    border: 1px solid #ece8df;
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.editor-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
}

.editor-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 500;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.editor-tabs {
    display: flex;
    background: var(--border-light);
    border-radius: 4px;
    padding: 4px;
}

.editor-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.editor-tab.active {
    background: white;
    color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.editor-tab svg {
    width: 16px;
    height: 16px;
}

/* Visual Editor */
.visual-editor {
    display: none;
    height: 800px;
    overflow-y: auto;
}

.visual-editor.active {
    display: block;
}

.page-preview {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    min-height: 100%;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.page-section {
    position: relative;
}

.page-header,
.page-footer {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-medium);
    position: relative;
}

.page-header::before {
    content: "Header (read-only)";
    position: absolute;
    top: 10px;
    left: 20px;
    background: var(--text-muted);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

.page-footer::before {
    content: "Footer (read-only)";
    position: absolute;
    top: 10px;
    left: 20px;
    background: var(--text-muted);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

.page-sidebar {
    background: var(--border-light);
    border: 2px dashed var(--border-dark);
    position: relative;
}

.page-sidebar::before {
    content: "Sidebar (read-only)";
    position: absolute;
    top: 10px;
    left: 20px;
    background: var(--text-muted);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

.page-content {
    border: 3px solid #000000;
    position: relative;
}

.page-content::before {
    content: "Editable Content";
    position: absolute;
    top: -16px;
    left: 20px;
    background: #000000;
    color: white;
    padding: 4px 12px;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

/* WYSIWYG Toolbar */
.wysiwyg-toolbar {
    background: white;
    border-bottom: 2px solid var(--border-light);
    padding: 12px 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.toolbar-group {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 0 12px;
    border-right: 1px solid var(--border-medium);
}

.toolbar-group:last-child {
    border-right: none;
}

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

.toolbar-btn:hover {
    background: var(--border-light);
    color: #1a1a1a;
}

.toolbar-btn.active {
    background: #000000;
    color: white;
}

.toolbar-select {
    padding: 8px 12px;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    background: white;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    min-width: 120px;
}

.toolbar-select:focus {
    outline: none;
    border-color: #000000;
}

/* Content Editor */
.content-editor {
    min-height: 400px;
    padding: 32px;
    outline: none;
    font-size: 16px;
    line-height: 1.6;
    color: #1a1a1a;
}

.content-editor:focus {
    outline: none;
}

/* WYSIWYG Content Styling */
.content-editor h1,
.content-editor h2,
.content-editor h3,
.content-editor h4,
.content-editor h5,
.content-editor h6 {
    font-weight: 700;
    margin: 24px 0 16px 0;
    line-height: 1.3;
}

.content-editor h1 { font-size: 2.5rem; }
.content-editor h2 { font-size: 2rem; }
.content-editor h3 { font-size: 1.5rem; }
.content-editor h4 { font-size: 1.25rem; }
.content-editor h5 { font-size: 1.125rem; }
.content-editor h6 { font-size: 1rem; }

.content-editor p {
    margin: 16px 0;
    line-height: 1.7;
}

.content-editor ul,
.content-editor ol {
    margin: 16px 0;
    padding-left: 32px;
}

.content-editor li {
    margin: 8px 0;
}

.content-editor a {
    color: #000000;
    text-decoration: underline;
}

.content-editor a:hover {
    color: #000000;
}

.content-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 16px 0;
}

.content-editor blockquote {
    border-left: 4px solid #000000;
    padding-left: 20px;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-muted);
}

.content-editor code {
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.9em;
}

.content-editor pre {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 16px 0;
}

.content-editor pre code {
    background: none;
    padding: 0;
}

/* Empty state styling */
.content-editor:empty::before {
    content: "Start writing your content here...";
    color: var(--text-disabled);
    font-style: italic;
}

/* Selection styling */
.content-editor ::selection {
    background: #e5e5e5;
    color: #202020;
}

/* Focus styling for content elements */
.content-editor:focus-within {
    background: var(--bg-secondary);
}

/* Link modal styles */
.link-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    z-index: 1000;
    min-width: 400px;
}

.link-modal h3 {
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
}

.link-modal input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

.link-modal input:focus {
    outline: none;
    border-color: #000000;
}

.link-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image modal styles */
.image-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    z-index: 1000;
    min-width: 400px;
}

.image-modal h3 {
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
}

.image-modal input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

.image-modal input:focus {
    outline: none;
    border-color: #000000;
}

.image-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Property Controls */
.property-group {
    margin-bottom: 24px;
}

.property-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.property-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.property-input:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Code Editor */
.code-editor {
    display: none;
    padding: 20px;
}

.code-editor.active {
    display: block;
}

.editor {
    width: 100%;
    height: 600px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    padding: 20px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.editor:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
    background: white;
}

.editor-footer {
    padding: 24px 32px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

/* Loading states */
.saving {
    opacity: 0.7;
    pointer-events: none;
}

.save-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #000000;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    font-weight: 600;
    z-index: 1000;
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.save-indicator.show {
    transform: translateY(0);
    opacity: 1;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #000000 0%, #000000 100%);
    color: white;
    padding: 14px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    margin-right: 12px;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s;
    font-size: 15px;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-accent);
    color: var(--text-muted);
    border: 2px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--border-medium);
    color: var(--text-secondary);
    transform: translateY(-2px);
}

.logout {
    color: var(--text-muted);
    text-decoration: none;
    padding: 10px 20px;
    border: 2px solid var(--border-medium);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.logout:hover {
    color: #000000;
    border-color: #000000;
}

/* Messages */
.message {
    padding: 20px 24px;
    border-radius: 4px;
    margin-bottom: 24px;
    font-weight: 600;
    border: 1px solid;
}

.success {
    background: #f5f5f5;
    color: #000000;
    border-color: #e0e0e0;
}

.error {
    background: #f5f5f5;
    color: #202020;
    border-color: #e0e0e0;
}

/* Welcome Card */
.welcome-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 48px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    border: 1px solid #ece8df;
}

.welcome-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-weight: 500;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--card-spacing);
    margin-top: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 32px 24px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #ece8df;
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    color: #000000;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Dark mode fixes for white backgrounds */
[data-theme="dark"] .login-container {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .login-form input {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

[data-theme="dark"] .login-form input:focus {
    background: var(--bg-accent);
}

[data-theme="dark"] .editor-container {
    background: var(--bg-secondary);
    border-color: var(--border-medium);
}

[data-theme="dark"] .editor-header {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
}

[data-theme="dark"] .editor-title {
    color: var(--text-primary);
}

[data-theme="dark"] .editor-tabs {
    background: var(--bg-accent);
}

[data-theme="dark"] .editor-tab {
    color: var(--text-muted);
}

[data-theme="dark"] .editor-tab.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .page-preview {
    background: var(--bg-secondary);
}

[data-theme="dark"] .wysiwyg-toolbar {
    background: var(--bg-secondary);
    border-color: var(--border-medium);
}

[data-theme="dark"] .toolbar-btn {
    color: var(--text-muted);
}

[data-theme="dark"] .toolbar-btn:hover {
    background: var(--bg-accent);
    color: var(--text-primary);
}

[data-theme="dark"] .toolbar-btn.active {
    background: #000000;
    color: white;
}

[data-theme="dark"] .toolbar-select {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

[data-theme="dark"] .content-editor {
    color: var(--text-primary);
}

[data-theme="dark"] .content-editor:focus-within {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .content-editor code {
    background: var(--bg-accent);
    color: var(--text-primary);
}

[data-theme="dark"] .content-editor pre {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .content-editor blockquote {
    color: var(--text-muted);
}

[data-theme="dark"] .link-modal,
[data-theme="dark"] .image-modal {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .link-modal input,
[data-theme="dark"] .image-modal input {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

[data-theme="dark"] .editor {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .editor:focus {
    background: var(--bg-accent);
}

[data-theme="dark"] .editor-footer {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .welcome-card {
    background: var(--bg-secondary);
    border-color: var(--border-medium);
}

[data-theme="dark"] .welcome-title {
    color: var(--text-primary);
}

[data-theme="dark"] .stat-card {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
}

[data-theme="dark"] .ai-loading-content {
    background: var(--bg-secondary);
}

[data-theme="dark"] .ai-loading-title {
    color: var(--text-primary);
}

[data-theme="dark"] .ai-loading-subtitle {
    color: var(--text-secondary);
}

[data-theme="dark"] .ai-loading-progress {
    background: var(--bg-accent);
}

[data-theme="dark"] .file-stack {
    background: var(--bg-secondary);
}

[data-theme="dark"] .file-card {
    background: var(--bg-secondary);
}

[data-theme="dark"] .action-btn {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

[data-theme="dark"] .action-btn:hover {
    background: var(--bg-accent);
}

[data-theme="dark"] .lightbox-card {
    background: var(--bg-secondary);
}

[data-theme="dark"] .lightbox-close {
    background: rgba(30, 41, 59, 0.9);
}

[data-theme="dark"] .lightbox-close:hover {
    background: var(--bg-secondary);
}

[data-theme="dark"] .media-library-modal {
    background: var(--bg-secondary);
}

[data-theme="dark"] .modal-close {
    color: var(--text-muted);
}

[data-theme="dark"] .modal-close:hover {
    color: var(--text-primary);
}

[data-theme="dark"] .modal-tabs {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .modal-tab {
    color: var(--text-muted);
}

[data-theme="dark"] .modal-tab:hover:not(.active) {
    color: var(--text-primary);
}

[data-theme="dark"] .media-select-item {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .media-item-title {
    color: var(--text-primary);
}

[data-theme="dark"] #url-tab .form-input {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

/* Dark mode input fields */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="email"]:focus,
[data-theme="dark"] input[type="url"]:focus,
[data-theme="dark"] input[type="number"]:focus,
[data-theme="dark"] input[type="password"]:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    background: var(--bg-accent);
    border-color: var(--border-strong);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 50vh;
    }
    
    .main {
        padding: 20px;
    }
    
    .creation-section {
        margin: 8px;
        padding: 20px;
    }
    
    .welcome-card {
        padding: 32px 24px;
    }
}

/* AI Loading Overlay */
.ai-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ai-loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.ai-loading-content {
    background: white;
    padding: 48px 40px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    max-width: 400px;
    width: 90%;
}

.ai-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-light);
    border-top: 4px solid #000000;
    border-radius: 4px;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ai-loading-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.ai-loading-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.ai-loading-progress {
    background: var(--border-light);
    height: 4px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}

.ai-loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #000000, #000000);
    border-radius: 3px;
    animation: progress 3s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.ai-loading-tips {
    font-size: 14px;
    color: var(--text-disabled);
    font-style: italic;
}

/* Media Library Dashboard */
.media-library-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--card-spacing);
}

.file-stack {
    position: relative;
    background: white;
    border-radius: 4px;
    overflow: visible;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.file-stack:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.stack-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 10;
}

.stack-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.stack-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.stack-cards {
    position: relative;
}

.file-card {
    position: relative;
    background: white;
    transition: all 0.3s ease;
    border-radius: 4px;
    overflow: hidden;
}

.file-card.stacked {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.file-card.stacked:nth-child(2) {
    transform: translate(6px, 6px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: -1;
}

.file-card.stacked:nth-child(3) {
    transform: translate(12px, 12px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: -2;
}

.file-card.stacked:nth-child(4) {
    transform: translate(18px, 18px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: -3;
}

.file-image {
    width: 100%;
    height: 320px;
    object-fit: cover;
    display: block;
}

.file-info {
    padding: 16px;
}

.file-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.file-size {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.file-date {
    font-size: 12px;
    color: var(--text-disabled);
}

.file-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.action-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-medium);
    background: white;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.action-btn:hover {
    background: #f5f5f5;
    border-color: var(--border-dark);
}

.action-btn.delete {
    color: var(--text-muted);
}

.action-btn.delete:hover {
    color: #000000;
    border-color: #000000;
}

.icon-sm {
    width: 14px;
    height: 14px;
}

.icon-xs {
    width: 12px;
    height: 12px;
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    max-width: 100%;
}

.lightbox-card {
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    flex: 0 0 auto;
    max-width: calc((95vw - 100px) / 3);
    min-width: 250px;
}

.lightbox-card .file-image {
    width: 100%;
    height: auto;
    max-height: 40vh;
    object-fit: cover;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.lightbox-close:hover {
    background: white;
}

/* Media Upload Modal */
.media-upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.media-upload-modal.active {
    display: flex;
}

.upload-modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    max-width: 80%;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

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

.upload-modal-body {
    padding: 20px;
}

.media-uploader-container {
    min-height: 300px;
}

/* Analytics Dashboard Styles */
.analytics-dashboard {
    max-width: 1200px;
}

.analytics-header {
    margin-bottom: 32px;
}

.analytics-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--card-spacing);
    margin-bottom: 32px;
}

.analytics-stat-card {
    background: var(--bg-secondary);
    border: 1px solid #ece8df;
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 1px 2px var(--shadow-light);
    transition: transform 0.2s, box-shadow 0.2s;
}

.analytics-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-medium);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1;
}

.stat-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-change {
    font-size: 14px;
    color: var(--text-muted);
}

.analytics-charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--card-spacing);
    margin-bottom: 32px;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid #ece8df;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: 0 1px 2px var(--shadow-light);
}

.chart-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.chart-card canvas {
    width: 100% !important;
    height: 200px !important;
}

.popular-pages-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.popular-pages-item:last-child {
    border-bottom: none;
}

.popular-page-title {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    margin-right: 12px;
}

.popular-page-views {
    font-size: 14px;
    font-weight: 600;
    color: #000000;
    background: var(--bg-accent);
    padding: 4px 8px;
    border-radius: var(--border-radius);
}

.analytics-heatmap-section {
    background: var(--bg-secondary);
    border: 1px solid #ece8df;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: 0 1px 2px var(--shadow-light);
    margin-bottom: 32px;
}

.analytics-heatmap-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.heatmap-container {
    position: relative;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-medium);
    border-radius: 4px;
    min-height: 400px;
    max-height: 600px;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.heatmap-instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 40px;
    line-height: 1.6;
    width: calc(100% - 80px);
}

.heatmap-point {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: heatmapPulse 2s infinite;
}

@keyframes heatmapPulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
}

.analytics-setup-card {
    background: var(--bg-secondary);
    border: 1px solid #ece8df;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: 0 1px 2px var(--shadow-light);
}

.analytics-setup-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.setup-code {
    display: block;
    background: var(--bg-accent);
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 14px;
    color: var(--text-primary);
    margin: 16px 0;
    word-break: break-all;
}

.setup-notes {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.setup-notes p {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.setup-notes ul {
    margin: 12px 0 12px 20px;
    color: var(--text-muted);
}

.setup-notes li {
    margin-bottom: 6px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .analytics-charts-row {
        grid-template-columns: 1fr;
    }
    
    .analytics-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Media Library Modal Styles */
.media-library-modal {
    background: white;
    border-radius: 4px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.media-library-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-medium);
}

.media-library-modal .modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #1a1a1a;
}

.modal-tabs {
    display: flex;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-medium);
    background: #f5f5f5;
}

.modal-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.modal-tab.active {
    color: #000000;
    border-bottom-color: #000000;
}

.modal-tab:hover:not(.active) {
    color: #1a1a1a;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.media-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.media-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-medium);
    border-top-color: #000000;
    border-radius: 4px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.media-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.media-select-item {
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: #f5f5f5;
}

.media-select-item:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.media-select-item.media-item-selected {
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.media-select-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.media-item-info {
    padding: 8px;
    font-size: 12px;
}

.media-item-title {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-item-alt {
    color: var(--text-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-media {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-medium);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

#url-tab .form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-medium);
    border-radius: var(--border-radius);
    font-size: 14px;
}

#url-tab .form-input:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Reviews Admin */
.reviews-admin {
    display: flex;
    flex-direction: column;
    gap: var(--card-spacing);
}

.reviews-admin.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.reviews-admin__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--card-spacing);
    align-items: flex-start;
}

.reviews-admin__title {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.reviews-admin__subtitle {
    margin: 0;
    color: var(--text-muted);
}

.reviews-admin__metrics {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.reviews-admin__metric {
    background: var(--bg-secondary);
    border: 1px solid #ece8df;
    border-radius: 4px;
    padding: 14px 18px;
    min-width: 110px;
    text-align: center;
}

.reviews-admin__metric-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.reviews-admin__metric-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-top: 4px;
}

.reviews-admin__filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.reviews-admin__filter {
    border: 1px solid #ece8df;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.reviews-admin__filter:hover,
.reviews-admin__filter:focus {
    transform: translateY(-1px);
    outline: none;
}

.reviews-admin__filter.is-active {
    background: #000000;
    border-color: #000000;
    color: #ffffff;
}

.reviews-admin__flash {
    border-radius: 4px;
    padding: 12px 16px;
    font-weight: 600;
    border: 1px solid #ece8df;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.reviews-admin__flash.is-success {
    background: #e5e5e5;
    border-color: #000000;
    color: #202020;
}

.reviews-admin__flash.is-error {
    background: #e5e5e5;
    border-color: #000000;
    color: #202020;
}

.reviews-admin__list {
    display: grid;
    gap: 18px;
}

.reviews-admin__empty {
    padding: 40px 20px;
    border: 1px dashed var(--border-light);
    border-radius: 4px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-secondary);
}

.reviews-admin__card {
    background: #ffffff;
    border: 1px solid #ece8df;
    border-radius: 4px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

[data-theme="dark"] .reviews-admin__card {
    background: var(--bg-secondary);
}

.reviews-admin__card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.reviews-admin__card-rating {
    font-size: 16px;
    color: #202020;
    letter-spacing: 2px;
}

.reviews-admin__card-name {
    margin: 4px 0 0 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.reviews-admin__badge {
    border-radius: var(--border-radius);
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.reviews-admin__badge.is-pending {
    background: #e5e5e5;
    color: #202020;
}

.reviews-admin__badge.is-approved {
    background: #e5e5e5;
    color: #202020;
}

.reviews-admin__badge.is-rejected {
    background: #e5e5e5;
    color: #202020;
}

.reviews-admin__card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.reviews-admin__card-meta span,
.reviews-admin__card-meta a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.reviews-admin__card-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
}

.reviews-admin__card-image img {
    max-width: 160px;
    border-radius: 4px;
    border: 1px solid #ece8df;
}

.reviews-admin__card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.reviews-admin__card-actions-primary {
    display: flex;
    gap: 8px;
}

.reviews-admin__edit {
    border-top: 1px solid var(--border-light);
    padding-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reviews-admin__edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 18px;
}

.reviews-admin__edit label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.reviews-admin__edit input,
.reviews-admin__edit textarea {
    font-size: 14px;
    border: 1px solid #ece8df;
    border-radius: 4px;
    padding: 10px 12px;
    color: var(--text-primary);
    background: transparent;
}

.reviews-admin__edit textarea {
    resize: vertical;
}

.reviews-admin__edit-full {
    width: 100%;
}

.reviews-admin__edit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.reviews-admin__edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-danger {
    background: #000000;
    color: #ffffff;
    border: none;
}

.btn-danger:hover,
.btn-danger:focus {
    background: #202020;
}

@media (max-width: 768px) {
    .reviews-admin__header {
        flex-direction: column;
    }

    .reviews-admin__metrics {
        width: 100%;
    }

    .reviews-admin__card-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .reviews-admin__card-actions-primary {
        width: 100%;
        justify-content: space-between;
    }

    .reviews-admin__card-actions-primary .btn,
    .reviews-admin__card-actions .btn {
        flex: 1;
    }
}

/* Email Log */
.emails-admin {
    display: flex;
    flex-direction: column;
    gap: var(--card-spacing);
}

.emails-admin__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.emails-admin__title {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.emails-admin__subtitle {
    margin: 0;
    color: var(--text-muted);
}

.emails-admin__meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.emails-admin__form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid #ece8df;
    border-radius: 4px;
}

.emails-admin__form-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    flex: 1 1 280px;
}

.emails-admin__form-label input {
    padding: 10px 12px;
    border: 1px solid #ece8df;
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-primary);
    background: transparent;
}

.emails-admin__empty {
    padding: 40px 20px;
    border: 1px dashed var(--border-light);
    border-radius: 4px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-secondary);
}

.emails-admin__table-wrapper {
    overflow-x: auto;
    border: 1px solid #ece8df;
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] .emails-admin__table-wrapper {
    background: var(--bg-secondary);
}

.emails-admin__table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.emails-admin__table th,
.emails-admin__table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    vertical-align: top;
}

.emails-admin__table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: var(--bg-secondary);
}

.emails-admin__table tr:last-child td {
    border-bottom: none;
}

.emails-admin__recipient {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.emails-admin__recipient span {
    color: var(--text-muted);
    font-size: 12px;
}

.emails-admin__subject {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emails-admin__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.emails-admin__status--sent {
    background: #e5e5e5;
    color: #202020;
}

.emails-admin__status--failed,
.emails-admin__status--error {
    background: #e5e5e5;
    color: #202020;
}

.emails-admin__status--queued {
    background: #e5e5e5;
    color: #202020;
}

.emails-admin__status-note {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #202020;
}

.emails-admin__details {
    font-size: 13px;
}

.emails-admin__details summary {
    cursor: pointer;
    color: #000000;
    font-weight: 600;
}

.emails-admin__details-content {
    margin-top: 12px;
    display: grid;
    gap: 16px;
}

.emails-admin__details-content h4 {
    margin: 0 0 6px 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.emails-admin__details-content pre {
    max-height: 200px;
    overflow: auto;
    background: var(--bg-secondary);
    border: 1px solid #ece8df;
    border-radius: 4px;
    padding: 10px;
    white-space: pre-wrap;
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    color: var(--text-primary);
}

/* Content Overview */
.content-overview {
    display: flex;
    flex-direction: column;
    gap: var(--card-spacing);
}

.overview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--card-spacing);
    flex-wrap: wrap;
}

.overview-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.overview-subtitle {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-muted);
}

.overview-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-ghost,
.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    border-radius: 4px;
    padding: 10px 18px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #000000;
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
}

.btn-link {
    padding: 0;
    border: none;
    background: none;
    color: #000000;
}

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

.overview-grid {
    display: grid;
    gap: var(--card-spacing);
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.overview-card {
    background: var(--bg-secondary);
    border: 1px solid #ece8df;
    border-radius: 4px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--shadow-light);
}

.overview-card h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.overview-seo-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.overview-seo-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}
.overview-seo-form input,
.overview-seo-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.overview-seo-form input:focus,
.overview-seo-form textarea:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}
.overview-seo-form textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}
.overview-seo-actions {
    display: flex;
    justify-content: flex-end;
}
.field-hint {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-muted);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.stat-item {
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.detail-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-list span {
    color: var(--text-muted);
}

.detail-list code {
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: var(--border-radius);
    font-size: 13px;
    color: var(--text-secondary);
}

/* User management */
.user-table-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.user-table-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.user-table-summary {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.user-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #ece8df;
    border-radius: 4px;
    background: var(--bg-secondary);
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.user-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-medium);
}

.user-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.user-table__th-actions,
.user-table__actions {
    text-align: right;
    white-space: nowrap;
}

.user-table__row:last-of-type td {
    border-bottom: none;
}

.user-table__primary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-table__name {
    font-weight: 600;
}

.user-table__badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #000000;
    background: rgba(0, 0, 0, 0.16);
    padding: 2px 6px;
    border-radius: 4px;
}

.user-table__meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.user-table__email {
    color: var(--text-primary);
    text-decoration: none;
}

.user-table__email:hover {
    text-decoration: underline;
}

.user-table__muted {
    color: var(--text-muted);
    font-size: 13px;
}

.user-table__role {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.user-table__role--admin {
    color: #202020;
    background: rgba(37, 99, 235, 0.15);
}

.user-table__role--editor {
    color: #202020;
    background: rgba(16, 185, 129, 0.16);
}

.user-table__edit-btn {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
}

.user-table-empty {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 14px;
}

.user-edit-row {
    display: none;
}

.user-edit-row.is-open {
    display: table-row;
}

.user-edit-form {
    margin-top: -1px;
    background: var(--bg-tertiary);
    border: 1px solid #ece8df;
    border-radius: 4px;
    padding: 20px;
}

.user-edit-form__grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.user-edit-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.user-edit-form input,
.user-edit-form select,
.user-edit-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.user-edit-form textarea {
    min-height: 140px;
    resize: vertical;
}

.user-edit-form input:focus,
.user-edit-form select:focus,
.user-edit-form textarea:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.user-edit-form__bio-field {
    grid-column: 1 / -1;
}

.user-edit-form__meta {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    font-size: 12px;
    color: var(--text-muted);
}

.user-edit-form__actions {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.user-edit-form__actions-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user-edit-cancel {
    font-size: 13px;
}

.user-table-pagination {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.user-table-pagination__summary {
    font-size: 13px;
    color: var(--text-muted);
}

.user-table-pagination__controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.user-table-pagination__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.user-table-pagination__link:hover {
    background: var(--bg-tertiary);
}

.user-table-pagination__link.is-active {
    background: #000000;
    border-color: #000000;
    color: #ffffff;
    pointer-events: none;
}

.user-create-card {
    margin-top: 24px;
}

.user-create-help {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}

@media (max-width: 960px) {
    .user-table {
        min-width: 100%;
    }

    .user-table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-table-summary {
        font-size: 12px;
    }

    .user-edit-form__grid {
        grid-template-columns: 1fr;
    }

    .user-edit-form__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .user-edit-form__actions-right {
        justify-content: flex-end;
        width: 100%;
    }
}

/* Account settings */
.account-wrapper {
    max-width: 1040px;
    margin: 0 auto;
    padding: 48px 32px 64px;
}

.account-hero {
    display: flex;
    align-items: center;
    gap: var(--card-spacing);
    padding: 28px;
    border-radius: var(--border-radius);
    background: rgba(0, 0, 0, 0.05);
}

.account-hero__avatar {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 4px;
    background: linear-gradient(135deg, #000000 0%, #000000 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.account-hero__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.account-hero__label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.account-hero__title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
}

.account-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    font-size: 14px;
    color: var(--text-secondary);
}

.account-hero__badge {
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(37, 99, 235, 0.14);
    color: #202020;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.account-message {
    margin-top: 24px;
    margin-bottom: 0;
}

.account-columns {
    margin-top: 32px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--card-spacing);
    align-items: start;
}

.account-columns__secondary {
    display: flex;
    flex-direction: column;
    gap: var(--card-spacing);
}

.account-card {
    border-radius: 4px;
}

.account-card__intro {
    margin: 0 0 16px 0;
    color: var(--text-muted);
    font-size: 14px;
}

.account-form textarea {
    min-height: 200px;
}

.account-preview {
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    padding: 20px;
    background: var(--bg-tertiary);
}

.account-preview .author-bio {
    margin-top: 0;
    padding: 24px;
    background: var(--bg-secondary);
    border-left-color: #000000;
}

@media (max-width: 960px) {
    .account-wrapper {
        padding: 32px 20px 48px;
    }

    .account-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .account-hero__avatar {
        width: 64px;
        height: 64px;
        font-size: 26px;
    }

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

    .account-columns__secondary {
        flex-direction: column;
    }
}

.excerpt-text {
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 18px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.overview-note {
    background: var(--bg-accent);
    border: 1px dashed var(--border-medium);
    border-radius: 4px;
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.template-editor-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.code-textarea {
    width: 100%;
    min-height: 420px;
    font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', monospace);
    font-size: 14px;
    line-height: 1.6;
    padding: 16px;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    resize: vertical;
}

.code-textarea:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.template-editor-actions {
    display: flex;
    justify-content: flex-end;
}

.template-editor-hint {
    font-size: 13px;
    color: var(--text-muted);
}

.empty-state-card {
    background: var(--bg-secondary);
    border: 1px solid #ece8df;
    border-radius: 4px;
    padding: 48px 32px;
    text-align: center;
    box-shadow: 0 1px 3px var(--shadow-light);
}

.empty-state-card h2 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.empty-state-card p {
    color: var(--text-muted);
    font-size: 14px;
}

@media (max-width: 768px) {
    .emails-admin__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .emails-admin__table {
        min-width: 100%;
    }
}

.builder-row-has-resize .builder-column {
    position: relative;
}

.builder-row-has-resize .builder-column-resizer {
    position: absolute;
    top: 14px;
    bottom: 14px;
    width: 12px;
    border: none;
    background: transparent;
    opacity: 0;
    cursor: col-resize;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 30;
    touch-action: none;
    transition: opacity 0.18s ease;
}

.builder-row-has-resize .builder-column:hover > .builder-column-resizer,
.builder-row-has-resize .builder-column-resizer.is-active {
    opacity: 1;
    pointer-events: auto;
}

.builder-row-has-resize .builder-column-resizer::before {
    content: '';
    width: 2px;
    height: 70%;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.18s ease, transform 0.18s ease;
}

.builder-row-has-resize .builder-column-resizer:hover::before,
.builder-row-has-resize .builder-column-resizer.is-active::before {
    background: rgba(0, 0, 0, 0.6);
    transform: scaleX(1.3);
}

.builder-row-has-resize .builder-column-resizer-right {
    right: -6px;
}

/* ============================================
   DRAG AND DROP STYLES
   ============================================ */

/* Element being dragged */
.is-dragging {
    opacity: 0.4 !important;
    cursor: grabbing !important;
    pointer-events: none !important;
}

/* Custom drag ghost image */
.drag-ghost {
    background: #000000;
    border-radius: var(--border-radius);
    padding: 12px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: white;
    font-weight: 600;
    font-size: 14px;
    pointer-events: none;
    z-index: 9999;
}

.drag-ghost__content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drag-ghost__icon {
    font-size: 20px;
    opacity: 0.9;
}

.drag-ghost__label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 13px;
}

/* Drop zone highlighting */
.drag-over {
    position: relative;
    outline: 1px dashed #000000 !important;
    outline-offset: 2px;
    background: rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease;
}

.drag-over-before::before,
.drag-over-after::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #000000;
    box-shadow: none;
    z-index: 1000;
}

.drag-over-before::before {
    top: -2px;
}

.drag-over-after::after {
    bottom: -2px;
}

.drag-over-inside {
    background: rgba(0, 0, 0, 0.03) !important;
    outline: 1px solid #000000 !important;
}

@keyframes pulse-line {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    }
}

/* Drag placeholder - insertion indicator */
.drag-placeholder {
    position: relative;
    margin: 8px 0;
    border: 1px dashed #000000;
    border-radius: var(--border-radius);
    background: rgba(0, 0, 0, 0.03);
    pointer-events: none;
    z-index: 999;
    animation: placeholder-appear 0.3s ease;
}

.drag-placeholder::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23667eea" stroke-width="2"><path d="M12 5v14M5 12h14"/></svg>') center/contain no-repeat;
    opacity: 0.5;
}

@keyframes placeholder-appear {
    from {
        opacity: 0;
        transform: scaleY(0.5);
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

/* Placeholder type-specific styling */
.drag-placeholder[data-placeholder-type="section"] {
    background: rgba(0, 0, 0, 0.03);
    border-color: #000000;
}

.drag-placeholder[data-placeholder-type="row"] {
    background: rgba(0, 0, 0, 0.03);
    border-color: #000000;
}

.drag-placeholder[data-placeholder-type="column"] {
    background: rgba(0, 0, 0, 0.03);
    border-color: #000000;
}

.drag-placeholder[data-placeholder-type="module"] {
    background: rgba(0, 0, 0, 0.03);
    border-color: #000000;
}

/* Enhanced drag handle styling for builder controls */
.builder-control-drag {
    cursor: grab !important;
    transition: all 0.2s ease;
}

.builder-control-drag:hover {
    transform: scale(1.1);
    color: #000000;
}

.builder-control-drag:active {
    cursor: grabbing !important;
    transform: scale(0.95);
}

/* Draggable elements hover state */
.builder-section[draggable="true"]:hover,
.builder-row[draggable="true"]:hover,
.builder-column[draggable="true"]:hover,
.builder-module[draggable="true"]:hover {
    outline: 1px dashed rgba(0, 0, 0, 0.2);
    outline-offset: 2px;
}

/* Smooth transitions for drag operations */
.builder-section,
.builder-row,
.builder-column,
.builder-module {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Dark mode adjustments */
[data-theme="dark"] .drag-ghost {
    background: #ffffff;
    color: #000000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .drag-over {
    outline-color: #ffffff !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .drag-over-before::before,
[data-theme="dark"] .drag-over-after::after {
    background: #ffffff;
}

[data-theme="dark"] .drag-placeholder {
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   BUILDER VISUAL CONTROLS (Border & Shadow)
   ============================================ */

.builder-border-control,
.builder-shadow-control {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    border: 1px solid #ece8df;
}

.builder-control-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.builder-border-grid,
.builder-shadow-grid {
    display: grid;
    gap: 12px;
}

.builder-border-grid {
    grid-template-columns: 1fr;
}

.builder-control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.builder-control-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.builder-control-compact > span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.builder-select-sm {
    padding: 8px 10px;
    border: 1px solid var(--border-medium);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.builder-select-sm:focus {
    outline: none;
    border-color: var(--text-primary);
}

.builder-range-sm {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-medium);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.builder-range-sm::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: var(--text-primary);
    cursor: pointer;
    transition: transform 0.2s;
}

.builder-range-sm::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.builder-range-sm::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: var(--text-primary);
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}

.builder-range-sm::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.builder-value-display {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    min-width: 45px;
}

.builder-color-sm {
    width: 100%;
    height: 36px;
    border: 1px solid var(--border-medium);
    border-radius: var(--border-radius);
    cursor: pointer;
    padding: 2px;
}

.builder-color-sm::-webkit-color-swatch-wrapper {
    padding: 0;
}

.builder-color-sm::-webkit-color-swatch {
    border: none;
    border-radius: calc(var(--border-radius) - 2px);
}

.builder-shadow-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* Spacing controls */
.builder-spacing-control {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
}

.builder-spacing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.builder-number-sm {
    padding: 8px 10px;
    border: 1px solid var(--border-medium);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    width: 100%;
    font-family: var(--font-mono);
}

.builder-number-sm:focus {
    outline: none;
    border-color: var(--text-primary);
    background: var(--bg-primary);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .builder-control-row {
        grid-template-columns: 1fr;
    }

    .builder-shadow-grid {
        grid-template-columns: 1fr;
    }

    .builder-spacing-grid {
        grid-template-columns: 1fr;
    }
}
