/**
 * CertiVal - Modern Glassmorphism Admin UI & Design System
 */

:root {
    --bg-main: #0b0f19;
    --bg-surface: #111827;
    --bg-card: rgba(17, 24, 39, 0.85);
    --bg-sidebar: #090d16;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(56, 189, 248, 0.25);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: rgba(2, 132, 199, 0.15);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    
    --info: #06b6d4;
    --info-light: rgba(6, 182, 212, 0.15);
    
    --purple: #8b5cf6;
    --purple-light: rgba(139, 92, 246, 0.15);

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: #38bdf8;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0284c7, #6366f1);
    color: #fff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 0 15px rgba(2, 132, 199, 0.4);
}

.logo-text h2 {
    font-size: 1.2rem;
    letter-spacing: -0.5px;
    line-height: 1.1;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0.85rem;
    overflow-y: auto;
}

.nav-section {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    padding: 0.75rem 0.75rem 0.35rem;
    margin-top: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.85rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.nav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-link:hover i {
    color: #38bdf8;
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(2, 132, 199, 0.2) 0%, rgba(2, 132, 199, 0.05) 100%);
    color: #38bdf8;
    border-left: 3px solid #38bdf8;
    font-weight: 600;
}

.nav-link.active i {
    color: #38bdf8;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

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

.user-info strong {
    display: block;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info small {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    color: var(--text-muted);
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-logout:hover {
    color: var(--danger);
    background: var(--danger-light);
}

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

/* Topbar */
.topbar {
    height: 64px;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 2rem;
}

.admin-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Cards & Containers */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.card-body {
    padding: 1.5rem;
}

/* Stat Cards Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: var(--border-glow);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.bg-primary-light { background: var(--primary-light); color: #38bdf8; }
.bg-success-light { background: var(--success-light); color: var(--success); }
.bg-warning-light { background: var(--warning-light); color: var(--warning); }
.bg-danger-light  { background: var(--danger-light); color: var(--danger); }
.bg-info-light    { background: var(--info-light); color: var(--info); }
.bg-purple-light  { background: var(--purple-light); color: var(--purple); }

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0.2rem 0;
}

.stat-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Action Banner */
.action-banner {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-md);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.action-banner-text h3 {
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.action-banner-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.action-banner-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #fff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    color: #fff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
}

.btn-outline-light {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-outline-primary {
    border-color: var(--primary);
    color: #38bdf8;
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-light);
    color: #fff;
}

.btn-outline-danger {
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--danger);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger-light);
    color: #fff;
}

.btn-outline-info {
    border-color: rgba(6, 182, 212, 0.4);
    color: var(--info);
    background: transparent;
}

.btn-outline-info:hover {
    background: var(--info-light);
    color: #fff;
}

.btn-outline-warning {
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--warning);
    background: transparent;
}

.btn-outline-warning:hover {
    background: var(--warning-light);
    color: #fff;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
    background: rgba(15, 23, 42, 1);
}

.form-control-sm {
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
}

textarea.form-control {
    resize: vertical;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.table td {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light); color: var(--info); }
.badge-dark    { background: rgba(0,0,0,0.5); color: #f8fafc; }
.badge-subtle  { background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }

.badge-code {
    font-family: monospace;
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    position: relative;
}

.alert-success { background: var(--success-light); border: 1px solid rgba(16, 185, 129, 0.3); color: #34d399; }
.alert-danger  { background: var(--danger-light); border: 1px solid rgba(239, 68, 68, 0.3); color: #f87171; }
.alert-warning { background: var(--warning-light); border: 1px solid rgba(245, 158, 11, 0.3); color: #fbbf24; }
.alert-info    { background: var(--info-light); border: 1px solid rgba(6, 182, 212, 0.3); color: #38bdf8; }

.alert-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2.5rem 1.5rem;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(15, 23, 42, 0.4);
}

.upload-dropzone:hover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.05);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-icon {
    font-size: 2.5rem;
    color: #38bdf8;
    margin-bottom: 0.75rem;
}

.dropzone-preview img {
    max-width: 100%;
    max-height: 240px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    margin-bottom: 0.5rem;
}

.preview-info {
    font-size: 0.8rem;
    color: #38bdf8;
    font-weight: 500;
}

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

.template-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.template-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
    border-color: var(--border-glow);
}

.template-preview-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    background: #000;
    overflow: hidden;
}

.template-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.template-card:hover .template-img {
    transform: scale(1.05);
}

.template-badges {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

.template-title {
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
}

.template-description {
    font-size: 0.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}

/* Slug copy widget */
.slug-badge-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(0,0,0,0.3);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
}

.slug-code {
    font-family: monospace;
    font-size: 0.8rem;
    color: #38bdf8;
}

.btn-copy {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    font-size: 0.8rem;
}

.btn-copy:hover {
    color: #fff;
}

/* Auth Pages */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at bottom, #1e1b4b 0%, #0b0f19 70%);
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
}

.auth-card {
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    backdrop-filter: blur(20px);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #0284c7, #6366f1);
    color: #fff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 0 25px rgba(2, 132, 199, 0.5);
}

.auth-header h2 {
    font-size: 1.6rem;
}

.auth-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.auth-credentials-hint {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Sidebar Mobile Drawer & Backdrop */
.sidebar-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

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

body.sidebar-open {
    overflow: hidden;
}

/* Designer Calibrator */
.designer-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    align-items: start;
}

.designer-canvas-container {
    display: flex;
    flex-direction: column;
    height: 75vh;
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-tool {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-tool:hover {
    background: rgba(255, 255, 255, 0.15);
}

.canvas-viewport {
    flex: 1;
    overflow: auto;
    background: #05070d;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.canvas-wrapper {
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    border: 1px solid var(--border-color);
    transform-origin: center center;
    transition: transform 0.15s ease;
}

#designerCanvas {
    display: block;
    max-width: none;
}

.designer-sidebar {
    max-height: 75vh;
    overflow-y: auto;
}

.designer-sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.4);
}

.designer-tab-btn {
    flex: 1;
    padding: 0.65rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.designer-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.designer-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(2, 132, 199, 0.08);
}

.element-layers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.element-layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.element-layer-item:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(2, 132, 199, 0.5);
    transform: translateX(2px);
}

.element-layer-item.active {
    background: rgba(2, 132, 199, 0.15);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.25);
}

.layer-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1;
}

.layer-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.element-layer-item.active .layer-icon {
    background: var(--primary);
    color: #fff;
}

.layer-title-box {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.layer-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-coords {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.layer-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.btn-layer-tool {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-layer-tool:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.btn-layer-tool.active-eye {
    color: var(--success);
}

.btn-layer-tool.hidden-eye {
    color: var(--danger);
    opacity: 0.6;
}

/* Utilities */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-end     { display: flex; justify-content: flex-end; align-items: center; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.col-grow { flex: 1; min-width: 0; }
.col-auto { flex: 0 0 auto; }
.row { display: flex; flex-wrap: wrap; margin: -0.5rem; }
.row > [class*="col-"] { padding: 0.5rem; }
.col-6 { width: 50%; }
.col-md-4 { width: 33.333%; }
.col-md-6 { width: 50%; }
.col-md-8 { width: 66.666%; }
.col-lg-4 { width: 33.333%; }
.col-lg-5 { width: 41.666%; }
.col-lg-6 { width: 50%; }
.col-lg-7 { width: 58.333%; }
.col-lg-8 { width: 66.666%; }
.col-12 { width: 100%; }
.h-100 { height: 100%; }

.text-white { color: #fff; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.85rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1.25rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1.25rem; }
.mt-auto { margin-top: auto; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }
.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 0.75rem !important; }
.p-4 { padding: 1.25rem !important; }
.pt-3 { padding-top: 0.75rem; }
.border-top { border-top: 1px solid var(--border-color); }
.hidden { display: none !important; }

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-wrapper .form-control {
    padding-left: 2.3rem;
}

.code-box {
    background: #05070d;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.8rem;
    line-height: 1.6;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   COMPREHENSIVE RESPONSIVE MEDIA QUERIES (Mobile, Tablet, Desktop)
   ========================================================================== */

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    /* Mobile Drawer Sidebar */
    .sidebar {
        position: fixed;
        left: -290px;
        top: 0;
        bottom: 0;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .sidebar.active {
        transform: translateX(290px);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    }

    .sidebar-close-btn {
        display: flex;
    }

    .sidebar-backdrop {
        display: block;
    }

    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        color: var(--text-primary);
        font-size: 1.1rem;
        cursor: pointer;
    }

    .topbar {
        padding: 0 1.25rem;
    }

    .page-content {
        padding: 1.25rem 1rem;
    }

    /* Grid layout collapses */
    .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-md-4, .col-md-6, .col-md-8 {
        width: 100%;
    }

    .designer-layout {
        grid-template-columns: 1fr;
    }

    .designer-canvas-container {
        height: 52vh;
    }

    .designer-sidebar {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .page-header.flex-between,
    .page-header .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
    }

    .page-header .btn-group {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-header .btn-group .btn {
        flex: 1;
        text-align: center;
        justify-content: center;
    }

    .action-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.25rem 1rem;
    }

    .action-banner-buttons {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-banner-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .designer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .designer-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .designer-actions .btn,
    .designer-actions .btn-group {
        flex: 1;
        justify-content: center;
    }

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

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

    .col-6 {
        width: 100%;
    }

    .filter-form .row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-form .col-grow,
    .filter-form .col-auto {
        width: 100%;
    }

    .filter-form .col-auto {
        display: flex;
        gap: 0.5rem;
    }

    .filter-form select,
    .filter-form .btn {
        width: 100%;
    }

    .card-header {
        padding: 1rem 1.25rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .table-responsive {
        border-radius: var(--radius-sm);
        border: 1px solid var(--border-color);
    }

    .table th, .table td {
        padding: 0.65rem 0.75rem;
        font-size: 0.8rem;
    }

    .slug-badge-wrapper {
        font-size: 0.75rem;
    }

    .topbar-title h1 {
        font-size: 1.05rem;
        max-width: 180px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-actions span {
        display: none;
    }

    .topbar-actions .btn {
        padding: 0.4rem 0.6rem;
    }
}

@media (max-width: 576px) {
    .topbar {
        height: 56px;
        padding: 0 0.85rem;
    }

    .page-content {
        padding: 0.85rem 0.6rem;
    }

    .card {
        border-radius: var(--radius-sm);
    }

    .card-header {
        padding: 0.85rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .form-control {
        font-size: 0.95rem; /* Prevents auto-zoom on mobile Safari */
        padding: 0.65rem 0.85rem;
    }

    .flex-end {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

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

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }

    .admin-footer {
        padding: 1rem;
        font-size: 0.75rem;
    }
}

