:root {
    /* Core Background Colors - Black/Dark Gray Theme */
    --bg-primary: #050505;
    --bg-secondary: #0f0f0f;

    /* Surface Colors with Glassmorphism */
    --surface: rgba(26, 26, 26, 0.4);
    --surface-hover: rgba(43, 43, 43, 0.6);
    --surface-glass: rgba(18, 18, 18, 0.6);

    /* Primary Accents - Vibrant Orange gradients */
    --color-primary: #f97316;
    --color-primary-hover: #ea580c;
    --color-primary-dim: rgba(249, 115, 22, 0.15);

    /* Accent Gradient for text/borders */
    --gradient-accent: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
    --gradient-glow: linear-gradient(135deg, rgba(249, 115, 22, 0.3) 0%, rgba(251, 146, 60, 0.3) 100%);

    /* Borders and text */
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-hover: rgba(255, 255, 255, 0.15);
    --color-text: #ffffff;
    --color-text-muted: #a1a1aa;

    /* Status Colors */
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;

    /* Shadows */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 25px -3px rgba(0, 0, 0, 0.5), 0 4px 10px -2px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.15);

    /* Glass blur effects */
    --glass-blur: blur(16px);
}

/* Background Gradients */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(45, 15, 80, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(249, 115, 22, 0.05) 0%, transparent 40%);
    z-index: -1;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

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

body {
    background: var(--bg-primary);
    color: var(--color-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 4px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.input-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Global Animations */
.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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

.script-card,
.admin-item,
.btn,
.stat-card {
    will-change: transform, box-shadow;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.navbar {
    will-change: backdrop-filter;
    transform: translateZ(0);
}

/* Navbar with Glassmorphism */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: 70px;
    background: var(--surface-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--color-border);
    z-index: 1000;
    transition: background-color 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

@supports not (backdrop-filter: blur(16px)) {
    .navbar {
        background: rgba(3, 0, 8, 0.95);
    }
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left {
    flex: 0 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    background: none;
    border: none;
    padding: 4px;
    border-radius: 8px;
}

.brand:hover {
    transform: scale(1.03);
}

.nav-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-title {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.5px;
    background: var(--gradient-accent);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 32px;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

#search {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 12px 20px 12px 48px;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(4px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#search:focus {
    border-color: rgba(249, 115, 22, 0.5);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px var(--color-primary-dim), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#search:focus+.search-icon {
    color: var(--color-primary);
}

.nav-right {
    flex: 0 0 auto;
    display: flex;
    gap: 12px;
    align-items: center;
}

.container {
    max-width: 1400px;
    margin: 100px auto 60px;
    padding: 0 32px;
    min-height: calc(100vh - 160px);
}

.content-wrapper {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 48px;
}

/* Sidebar Improvements */
.sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.sidebar-section {
    margin-bottom: 32px;
    background: var(--surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.sidebar-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--color-text-muted);
    text-transform: uppercase;
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar-link svg {
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar-link:hover {
    color: var(--color-text);
    background: var(--surface-hover);
    transform: translateX(4px);
}

.sidebar-link.active {
    color: #fff;
    background: var(--color-primary-dim);
    font-weight: 700;
}

.sidebar-link.active::before {
    opacity: 1;
}

.sidebar-link.active svg {
    opacity: 1;
    color: var(--color-primary);
}

.select-sm {
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
    height: 40px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
}

.select-sm:focus {
    border-color: var(--color-primary);
}

/* Script Grid & Cards */
.script-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.script-card {
    background: var(--surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.script-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.script-card:hover {
    transform: translateY(-5px);
    border-color: rgba(249, 115, 22, 0.3);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.5), 0 0 20px rgba(249, 115, 22, 0.1);
    background: var(--surface-hover);
}

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

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

.script-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    word-break: break-word;
    line-height: 1.3;
}

.card-meta {
    margin-top: auto;
    padding-top: 16px;
    font-size: 13px;
    color: var(--color-text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.badge {
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 8px;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.badge-sm {
    font-size: 10px;
    padding: 3px 8px;
}

.badge-public {
    background: rgba(249, 115, 22, 0.2);
    color: #fdba74;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-private {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-unlisted {
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* General Buttons */
.btn {
    background: var(--gradient-accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.3);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(249, 115, 22, 0.2);
}

.btn-secondary {
    background: var(--surface);
    border: 1px solid var(--color-border);
    color: #e2e8f0;
    box-shadow: none;
}

.btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: var(--surface-hover);
    filter: none;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-full {
    width: 100%;
    margin-top: 16px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 0, 8, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 20px;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 40px rgba(249, 115, 22, 0.1);
    position: relative;
    overflow: hidden;
}

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

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

.modal-header h3 {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
}

.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: var(--color-text-muted);
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

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

.input-field {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--color-border);
    color: #fff;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.input-field:focus {
    border-color: rgba(249, 115, 22, 0.5);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 4px var(--color-primary-dim), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.input-field::placeholder {
    color: #64748b;
}

/* Admin Panel */
.admin-top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: 0.2s;
}

.btn-back:hover {
    color: #fff;
    background: var(--surface);
}

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

.admin-header-flex h2 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
}

.tab-switcher {
    background: rgba(0, 0, 0, 0.3);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    display: flex;
    gap: 6px;
    backdrop-filter: blur(4px);
}

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

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--surface-hover);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.admin-item {
    padding: 24px;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: var(--surface-hover);
    transform: translateX(6px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.admin-item-left strong {
    font-size: 18px;
    color: #fff;
}

.admin-item-right {
    display: flex;
    gap: 12px;
}

/* Code Editor specifically */
.code-box {
    background: #020005;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.toolbar {
    background: var(--surface);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

pre {
    padding: 24px;
    background: transparent !important;
}

code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.7;
}

/* Notifications and Loaders */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(249, 115, 22, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin: 0 auto 20px;
}

/* Animations */
.animate__animated {
    animation-duration: 0.6s;
    animation-fill-mode: both;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate3d(0, -20px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.animate__fadeInDown {
    animation-name: fadeInDown;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate__fadeIn {
    animation-name: fadeIn;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale3d(0.95, 0.95, 0.95);
    }

    to {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

.animate__zoomIn {
    animation-name: zoomIn;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .navbar {
        height: 60px;
    }

    .container {
        margin-top: 80px;
        padding: 0 16px;
    }

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

    .admin-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .tab-switcher {
        width: 100%;
        overflow-x: auto;
    }

    .tab-btn {
        white-space: nowrap;
        flex: 1;
        justify-content: center;
    }
}