/* ============================================================
   DARK MODE (default) - Design system from ThirdEye
   ============================================================ */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-tertiary: #1a1a3a;
    --bg-card: #16162e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-muted: #606080;
    --accent-cyan: #00f5d4;
    --accent-blue: #00bbf9;
    --accent-purple: #9b5de5;
    --success: #00f5a0;
    --danger: #ff4757;
    --warning: #ffbe0b;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-glow: 0 0 40px rgba(0, 245, 212, 0.15);
    --gradient-primary: linear-gradient(135deg, #00f5d4, #00bbf9, #9b5de5);
    --gradient-success: linear-gradient(135deg, #00f5a0, #00d9a0);
    --header-bg: rgba(10, 10, 26, 0.95);
    --app-bg-gradient: radial-gradient(ellipse 80% 50% at 20% 20%, rgba(0, 245, 212, 0.08) 0%, transparent 50%),
                       radial-gradient(ellipse 60% 40% at 80% 80%, rgba(155, 93, 229, 0.08) 0%, transparent 50%);
    --login-btn-text: #0a0a1a;
    --scrollbar-thumb: #606080;
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition-fast: 0.15s ease;
}

/* ============================================================
   LIGHT MODE
   ============================================================ */
[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8ecf2;
    --bg-card: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-muted: #8888a0;
    --accent-cyan: #00b4a0;
    --accent-blue: #0099d6;
    --accent-purple: #7c4dbd;
    --success: #00b876;
    --danger: #e53e4f;
    --warning: #e5a000;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --gradient-primary: linear-gradient(135deg, #00b4a0, #0099d6, #7c4dbd);
    --gradient-success: linear-gradient(135deg, #00b876, #00a066);
    --header-bg: rgba(255, 255, 255, 0.95);
    --app-bg-gradient: radial-gradient(ellipse 80% 50% at 20% 20%, rgba(0, 180, 160, 0.05) 0%, transparent 50%),
                       radial-gradient(ellipse 60% 40% at 80% 80%, rgba(124, 77, 189, 0.05) 0%, transparent 50%);
    --login-btn-text: #ffffff;
    --scrollbar-thumb: #c0c0d0;
}

[data-theme="light"] ::selection {
    background: var(--accent-cyan);
    color: #ffffff;
}

/* ============================================================
   MATRIX MODE — Green Terminal Style
   ============================================================ */
[data-theme="matrix"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #0d0d0d;
    --bg-tertiary: #141414;
    --bg-card: #111111;
    --text-primary: #00ff00;
    --text-secondary: #00cc00;
    --text-muted: #006600;
    --accent-cyan: #00ff41;
    --accent-blue: #00ff41;
    --accent-purple: #39ff14;
    --success: #00ff00;
    --danger: #ff0040;
    --warning: #ccff00;
    --border-color: rgba(0, 255, 65, 0.15);
    --shadow-glow: 0 0 40px rgba(0, 255, 65, 0.2);
    --gradient-primary: linear-gradient(135deg, #00ff41, #00ff00, #39ff14);
    --gradient-success: linear-gradient(135deg, #00ff00, #00cc00);
    --header-bg: rgba(10, 10, 10, 0.98);
    --app-bg-gradient: radial-gradient(ellipse 80% 50% at 20% 20%, rgba(0, 255, 65, 0.05) 0%, transparent 50%),
                       radial-gradient(ellipse 60% 40% at 80% 80%, rgba(57, 255, 20, 0.05) 0%, transparent 50%);
    --login-btn-text: #0a0a0a;
    --scrollbar-thumb: #00aa00;
}

[data-theme="matrix"] body {
    text-shadow: 0 0 2px rgba(0, 255, 0, 0.3);
}

[data-theme="matrix"] input,
[data-theme="matrix"] select,
[data-theme="matrix"] textarea {
    background: #0a0a0a;
    border-color: rgba(0, 255, 65, 0.3);
    color: #00ff00;
}

[data-theme="matrix"] input:focus,
[data-theme="matrix"] select:focus,
[data-theme="matrix"] textarea:focus {
    border-color: #00ff41;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

[data-theme="matrix"] input::placeholder {
    color: #006600;
}

[data-theme="matrix"] ::selection {
    background: #00ff41;
    color: #0a0a0a;
}

[data-theme="matrix"] .data-table {
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.1);
}

[data-theme="matrix"] .form-card {
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.1);
}

[data-theme="matrix"] .modal {
    box-shadow: 0 0 60px rgba(0, 255, 65, 0.2);
}

[data-theme="matrix"] .version-item-header strong {
    text-shadow: 0 0 8px currentColor;
}

/* ============================================================
   PINK MODE — Soft & Elegant Style
   ============================================================ */
[data-theme="pink"] {
    --bg-primary: #f8f5f6;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0e8eb;
    --bg-card: #ffffff;
    --text-primary: #2A1128;
    --text-secondary: #5a4055;
    --text-muted: #9a8090;
    --accent-cyan: #F7288D;
    --accent-blue: #4A65FC;
    --accent-purple: #8610FD;
    --success: #6C9E52;
    --danger: #E13E20;
    --warning: #FBE035;
    --border-color: rgba(247, 40, 141, 0.15);
    --shadow-glow: 0 4px 24px rgba(247, 40, 141, 0.12);
    --gradient-primary: linear-gradient(135deg, #F7288D, #F3B3C2, #8610FD);
    --gradient-success: linear-gradient(135deg, #6C9E52, #5a8a45);
    --header-bg: rgba(255, 255, 255, 0.95);
    --app-bg-gradient: radial-gradient(ellipse 80% 50% at 20% 20%, rgba(243, 179, 194, 0.15) 0%, transparent 50%),
                       radial-gradient(ellipse 60% 40% at 80% 80%, rgba(247, 40, 141, 0.08) 0%, transparent 50%);
    --login-btn-text: #ffffff;
    --scrollbar-thumb: #F3B3C2;
}

[data-theme="pink"] input,
[data-theme="pink"] select,
[data-theme="pink"] textarea {
    background: #ffffff;
    border-color: rgba(243, 179, 194, 0.5);
    color: #2A1128;
}

[data-theme="pink"] input:focus,
[data-theme="pink"] select:focus,
[data-theme="pink"] textarea:focus {
    border-color: #F7288D;
    box-shadow: 0 0 0 3px rgba(247, 40, 141, 0.1);
}

[data-theme="pink"] input::placeholder {
    color: #9a8090;
}

[data-theme="pink"] ::selection {
    background: #F3B3C2;
    color: #2A1128;
}

[data-theme="pink"] .data-table {
    box-shadow: 0 4px 24px rgba(247, 40, 141, 0.08);
}

[data-theme="pink"] .form-card {
    box-shadow: 0 4px 24px rgba(247, 40, 141, 0.08);
    border-color: rgba(243, 179, 194, 0.4);
}

[data-theme="pink"] .navbar {
    box-shadow: 0 2px 20px rgba(243, 179, 194, 0.25);
    border-bottom-color: rgba(243, 179, 194, 0.3);
}

[data-theme="pink"] .modal {
    box-shadow: 0 8px 40px rgba(247, 40, 141, 0.15);
    border-color: rgba(243, 179, 194, 0.3);
}

[data-theme="pink"] .template-item:hover {
    border-color: #F7288D;
    box-shadow: 0 4px 12px rgba(247, 40, 141, 0.15);
}

[data-theme="pink"] .nav-link:hover,
[data-theme="pink"] .nav-link.active {
    border-color: #F7288D;
    color: #F7288D;
    background: rgba(247, 40, 141, 0.05);
}

[data-theme="pink"] .btn:hover {
    border-color: #F7288D;
    color: #F7288D;
}

[data-theme="pink"] .btn-primary:hover {
    box-shadow: 0 8px 24px rgba(247, 40, 141, 0.3);
    color: var(--login-btn-text);
}

/* ============================================================
   THEME SWITCHER
   ============================================================ */
.login-theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
}

.theme-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-left: 8px;
}

.theme-btn {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding: 0;
    background: transparent;
    position: relative;
}

.theme-btn:hover {
    transform: scale(1.1);
}

.theme-btn.active {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 245, 212, 0.3);
}

[data-theme="pink"] .theme-btn.active {
    border-color: #F7288D;
    box-shadow: 0 0 8px rgba(247, 40, 141, 0.3);
}

[data-theme="matrix"] .theme-btn.active {
    border-color: #00ff41;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
}

.theme-btn-dark {
    background: linear-gradient(135deg, #0a0a1a, #12122a);
}

.theme-btn-light {
    background: linear-gradient(135deg, #f5f7fa, #e8ecf2);
}

.theme-btn-matrix {
    background: linear-gradient(135deg, #0a0a0a, #003300);
}

.theme-btn-pink {
    background: linear-gradient(135deg, #f8f5f6, #F3B3C2);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--app-bg-gradient);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-blue);
    text-decoration: none;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 40px;
    height: 72px;
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.navbar-brand a {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-link:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(0, 245, 212, 0.05);
    text-decoration: none;
}

.nav-link.active {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(0, 245, 212, 0.1);
}

.nav-user {
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.nav-logout {
    border-color: rgba(255, 71, 87, 0.3);
    color: var(--text-secondary);
}

.nav-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(255, 71, 87, 0.05);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 40px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(0, 245, 212, 0.05);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--login-btn-text);
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 245, 212, 0.3);
    color: var(--login-btn-text);
}

.btn-danger {
    background: transparent;
    border-color: rgba(255, 71, 87, 0.3);
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(255, 71, 87, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-warning {
    background: transparent;
    border-color: rgba(255, 190, 11, 0.3);
    color: var(--warning);
}

.btn-warning:hover {
    background: rgba(255, 190, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

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

.alert-success {
    background: rgba(0, 245, 160, 0.1);
    color: var(--success);
    border: 1px solid rgba(0, 245, 160, 0.3);
}

.alert-error {
    background: rgba(255, 71, 87, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 71, 87, 0.3);
}

/* ============================================================
   TABLES
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-glow);
}

.data-table th,
.data-table td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.data-table tbody tr {
    transition: all 0.15s;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.inline-form {
    display: inline;
}

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

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

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-draft {
    background: rgba(255, 190, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(255, 190, 11, 0.3);
}

.badge-active {
    background: rgba(0, 245, 160, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 245, 160, 0.3);
}

.badge-closed,
.badge-archived {
    background: rgba(160, 160, 192, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-card {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-glow);
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.form-group-wide {
    flex: 2;
}

.form-group-sm {
    flex: 0.5;
    min-width: 100px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* ============================================================
   SEARCH / FILTER
   ============================================================ */
.search-bar,
.filter-bar {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.input-search {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--text-primary);
    width: 360px;
    transition: all 0.2s;
}

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

.input-search:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.1);
}

.filter-bar label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-bar select {
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-bar select:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-container {
    max-width: 420px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    /* Center vertically */
    margin-top: calc(50vh - 250px);
}

.login-container h1 {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 32px;
}

.form-login {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px;
    box-shadow: var(--shadow-glow);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-login .form-group {
    margin-bottom: 0;
}

.form-login .form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-login .form-group input {
    padding: 14px 16px;
    font-size: 15px;
}

.form-login .btn {
    width: 100%;
    justify-content: center;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 8px;
}

.form-login .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 245, 212, 0.3);
}

/* ============================================================
   EDITOR LAYOUT (3 columns) — Full width
   ============================================================ */
body.page-editor .main-content {
    max-width: none;
    padding: 0;
}

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

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

.editor-header-left h1 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    -webkit-text-fill-color: unset;
    background: none;
}

.editor-header-right {
    display: flex;
    gap: 8px;
}

.version-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    font-family: var(--font-mono);
}

.editor-layout {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    height: calc(100vh - 72px - 52px);
    overflow: hidden;
}

/* ============================================================
   EDITOR SIDEBARS
   ============================================================ */
.editor-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px;
}

.editor-sidebar-right {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.editor-sidebar h3 {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.sidebar-filter {
    margin-bottom: 16px;
}

.sidebar-filter select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-filter select:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

/* Template items in sidebar */
.template-item {
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all 0.2s;
    background: var(--bg-card);
}

.template-item:hover {
    border-color: var(--accent-purple);
    background: rgba(155, 93, 229, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(155, 93, 229, 0.15);
}

.template-item:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.template-item-title {
    display: block;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
}

.template-item-category {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Editor main area */
.editor-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.editor-status {
    padding: 6px 20px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    min-height: 28px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.editor-main .ck-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-main .ck-editor__main {
    flex: 1;
    overflow: auto;
}

.editor-main .ck-editor__editable {
    min-height: 100%;
    padding: 32px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: none;
}

.editor-main .ck-editor__editable.drag-over {
    background: rgba(0, 245, 212, 0.05);
    outline: 2px dashed var(--accent-cyan);
    outline-offset: -4px;
}

/* CKEditor toolbar override for dark theme */
.ck.ck-toolbar {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

.ck.ck-button,
.ck.ck-button:not(.ck-disabled):hover {
    color: var(--text-secondary) !important;
}

/* ============================================================
   SIDEBAR SECTIONS
   ============================================================ */
.sidebar-section {
    margin-bottom: 28px;
}

.client-info {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.client-info p {
    margin-bottom: 4px;
}

.client-info strong {
    color: var(--text-primary);
}

/* Version items */
.version-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.version-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.version-item-header strong {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
}

.version-item-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--danger);
    color: #fff;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    color: var(--text-secondary);
}

.modal-body hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 16px 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .navbar {
        padding: 0 20px;
    }

    .main-content {
        padding: 24px 20px;
    }

    .editor-layout {
        grid-template-columns: 220px 1fr 240px;
    }

    .form-row {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .navbar-menu {
        gap: 4px;
    }

    .nav-link {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* ============================================================
   SELECTION
   ============================================================ */
::selection {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}
