/* ============================================
   Kreator Szablonów - Full Stylesheet
   ============================================ */

/* --- CSS Variables --- */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #161625;
    --bg-card: #1c1c30;
    --bg-elevated: #22223a;
    --bg-input: #1a1a2e;
    --bg-hover: #2a2a45;

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;
    --text-accent: #a78bfa;

    --accent-primary: #6366f1;
    --accent-hover: #7c7ff7;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);

    --border-color: #2a2a40;
    --border-light: #353550;

    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    --info: #60a5fa;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

    --transition: all 0.2s ease;
    --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --sidebar-width: 340px;
    --nav-height: 56px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* --- Sections --- */
.section {
    display: none;
    height: 100vh;
    width: 100vw;
}

.section.active {
    display: flex;
    flex-direction: column;
}

/* ============================================
   LOGIN
   ============================================ */
.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(139, 92, 246, 0.06) 0%, transparent 60%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 48px 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    margin-bottom: 20px;
    display: inline-block;
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9375rem;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

.form-group.compact {
    margin-bottom: 10px;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

.input-sm {
    padding: 8px 10px !important;
    font-size: 0.8125rem !important;
}

.error-message {
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.8125rem;
    color: var(--error);
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: var(--radius-sm);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-family);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8125rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn-danger {
    color: var(--error);
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.2);
}

/* --- Navigation --- */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 0.9375rem;
}

.nav-brand svg {
    flex-shrink: 0;
}

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

.nav-user {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 100px;
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
}

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

.dashboard-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Template Grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.template-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.template-card:hover::before {
    opacity: 1;
}

.template-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.template-card h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
}

.template-card p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.template-card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.template-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.template-card-actions {
    display: flex;
    gap: 8px;
}

.template-card-actions .btn {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state svg {
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.875rem;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.3s ease;
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 0;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.modal-content form {
    padding: 24px 28px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 8px;
}

/* File Drop Zone */
.file-drop-zone {
    position: relative;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.file-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-content svg {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.drop-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.drop-content .link {
    color: var(--accent-primary);
    font-weight: 500;
}

.file-name {
    display: block;
    margin-top: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent-primary);
}

/* ============================================
   EDITOR LAYOUT
   ============================================ */
.editor-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.editor-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-tab {
    flex: 1;
    padding: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font-family);
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.sidebar-tab:hover:not(.active) {
    color: var(--text-secondary);
}

.sidebar-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

.sidebar-panel.active {
    display: flex;
}

/* Placeholder Form */
.placeholder-form {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.placeholder-form h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Placeholder List */
.placeholder-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.placeholder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.placeholder-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

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

.placeholder-item-path {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace, var(--font-family);
}

.placeholder-item-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.placeholder-item-tag {
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
    border-radius: 100px;
    flex-shrink: 0;
}

.placeholder-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.placeholder-item:hover .placeholder-item-actions {
    opacity: 1;
}

.placeholder-item-actions button {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.placeholder-item-actions button:hover {
    color: var(--error);
    background: rgba(248, 113, 113, 0.1);
}

/* Schema Views */
.schema-toggle {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.schema-view-btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-family);
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.schema-view-btn.active {
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.schema-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Tree */
.tree-node {
    margin-left: 16px;
    position: relative;
}

.tree-node::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.tree-key {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    cursor: default;
    font-size: 0.8125rem;
}

.tree-key:hover {
    background: var(--bg-hover);
}

.tree-key-name {
    font-weight: 600;
    color: var(--text-primary);
}

.tree-key-type {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-style: italic;
}

.tree-key-placeholder {
    font-size: 0.6875rem;
    color: var(--accent-primary);
    font-family: monospace;
    cursor: pointer;
}

.tree-key-placeholder:hover {
    text-decoration: underline;
}

/* JSON Pre */
#schema-json-pre {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 0.8125rem;
    line-height: 1.6;
    overflow-x: auto;
    color: var(--text-secondary);
}

#schema-json-pre code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ============================================
   EDITOR MAIN
   ============================================ */
.editor-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.editor-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.editor-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-primary);
    z-index: 10;
}

.editor-loading p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    min-width: 280px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--error);
}

.toast.info {
    border-left: 3px solid var(--info);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* ============================================
   ACCENT BUTTON (Export)
   ============================================ */
.btn-accent {
    color: #fff;
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.3);
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

/* ============================================
   TEST PANEL
   ============================================ */
.test-panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.test-panel-header h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.text-sm {
    font-size: 0.75rem;
}

.test-form {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.test-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.test-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}

.test-label code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.test-type-badge {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 1px 6px;
    border-radius: 99px;
    text-transform: uppercase;
}

.test-field-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.test-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.8125rem;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}

.test-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

.test-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.toast.warning {
    border-left: 3px solid #f59e0b;
}

/* ============================================
   SEARCH BAR
   ============================================ */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-input-wrap {
    flex: 1;
    position: relative;
}

.search-input-wrap .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input-wrap input {
    width: 100%;
    padding-left: 36px;
}

.search-bar select {
    min-width: 160px;
}

/* ============================================
   AUTO-DETECT PLACEHOLDERS
   ============================================ */
.detect-section {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.detect-group {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.detect-ok {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.detect-warning {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.detect-info {
    background: rgba(96, 165, 250, 0.08);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.detect-label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.detect-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detect-items code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.detect-item-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 10px;
    border-radius: 4px;
}

/* ============================================
   VERSION HISTORY
   ============================================ */
.version-list {
    overflow-y: auto;
    flex: 1;
}

.version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.version-item:hover {
    background: var(--bg-hover);
}

.version-current {
    background: rgba(99, 102, 241, 0.06);
    border-left: 3px solid var(--accent-primary);
}

.version-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.version-info strong {
    font-size: 13px;
}

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

.badge-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* ============================================
   PDF PREVIEW MODAL
   ============================================ */
.pdf-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: 900px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.pdf-viewer {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.pdf-viewer iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.pdf-viewer .editor-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
}

/* ============================================
   CARD ACTIONS (clone, delete buttons)
   ============================================ */
.card-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.card-actions .btn-primary {
    flex: 1;
}

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

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.1);
}

.btn-danger-icon {
    color: var(--error) !important;
    opacity: 0.6;
}

.btn-danger-icon:hover {
    opacity: 1;
}

.btn-icon-sm {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .editor-sidebar {
        width: 280px;
    }

    .dashboard-content {
        padding: 20px;
    }

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

    .login-card {
        margin: 16px;
        padding: 32px 24px;
    }

    .search-bar {
        flex-direction: column;
    }

    .pdf-modal-content {
        width: 95vw;
        height: 85vh;
    }
}