:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --input-bg: rgba(15, 23, 42, 0.6);
    --sidebar-width: 280px;
}

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

body {
    font-family: "Inter", sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dashboard-body {
    display: flex;
}

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

.glass-container {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Mobile Header */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 90;
}
.mobile-header .brand { margin: 0; font-size: 1.25rem; }
.menu-toggle {
    background: none; border: none; color: white;
    font-size: 1.5rem; cursor: pointer;
}

/* Sidebar Layout */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    z-index: 100;
    transition: transform 0.3s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    color: #fff;
}

.menu-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.nav-item.active {
    border-left: 3px solid var(--primary);
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    width: calc(100% - var(--sidebar-width));
    padding-bottom: 100px;
    transition: margin 0.3s ease, width 0.3s ease;
}

.page-header { margin-bottom: 2rem; }
.page-title { font-size: 2rem; font-weight: 700; color: #fff; margin-bottom: 0.5rem; }

/* List layout instead of cards grid */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

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

.list-item:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateX(4px);
}

.list-item-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.list-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.list-item-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.list-item-actions {
    display: flex;
    gap: 0.5rem;
}

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

.action-icon-btn:hover { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.action-icon-btn.danger:hover { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalScale 0.3s ease-out;
}

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: 1.25rem; font-weight: 600; color: white; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.25rem; cursor: pointer; }
.modal-close:hover { color: white; }

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group.grid-col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.form-group input, .form-group textarea {
    width: 100%; padding: 0.6rem 0.8rem; background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color); border-radius: 0.5rem;
    color: var(--text-primary); font-size: 0.9rem; outline: none; transition: all 0.2s;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.75rem 1.5rem; border-radius: 0.5rem; font-weight: 600; font-size: 1rem;
    cursor: pointer; border: none; transition: all 0.2s;
}
.btn.small { padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn.full-width { width: 100%; }
.btn.primary { background: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn.secondary { background: var(--input-bg); color: white; border: 1px solid var(--border-color); }
.btn.secondary:hover { background: rgba(255,255,255,0.1); }
.btn.danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn.danger:hover { background: var(--danger); color: white; }

.floating-save-bar {
    position: fixed; bottom: 0; left: var(--sidebar-width); width: calc(100% - var(--sidebar-width));
    background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color); padding: 1rem 2.5rem;
    display: flex; justify-content: flex-end; align-items: center;
    z-index: 50; box-shadow: 0 -10px 20px rgba(0,0,0,0.2);
    transition: left 0.3s ease, width 0.3s ease;
}

.url-box { display: flex; gap: 0.5rem; margin-bottom: 2rem; }
.url-box input {
    flex: 1; padding: 0.75rem 1rem; background: var(--input-bg);
    border: 1px solid var(--border-color); border-radius: 0.5rem;
    color: #93c5fd; font-family: monospace; font-size: 0.9rem; outline: none;
}

#jsonEditor {
    width: 100%; height: 600px; padding: 1rem; background: #020617;
    border: 1px solid var(--border-color); border-radius: 0.5rem;
    color: #38bdf8; font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.85rem; line-height: 1.5; outline: none; resize: vertical;
}

/* Auth Pages Specific */
.auth-box { width: 100%; max-width: 400px; padding: 2.5rem; border-radius: 1rem; animation: slideUp 0.5s ease-out; margin: 1rem; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.logo-area { text-align: center; margin-bottom: 2rem; }
.logo-icon { font-size: 3rem; margin-bottom: 0.5rem; display: inline-block; }
.logo-area h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.logo-area p { color: var(--text-muted); font-size: 0.9rem; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .mobile-header { display: flex; }
    
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,0.5); }
    
    .main-content {
        margin-left: 0; width: 100%;
        padding: 5.5rem 1rem 6rem 1rem; /* Top padding for mobile header, bottom for save bar */
    }
    
    .floating-save-bar { left: 0; width: 100%; padding: 1rem; justify-content: center; }
    .floating-save-bar .btn { width: 100%; }
    
    .page-title { font-size: 1.5rem; }
    .form-group.grid-col-2 { grid-template-columns: 1fr; gap: 0; }
    .card-grid { grid-template-columns: 1fr; }
    
    .url-box { flex-direction: column; }
    .url-box .btn { width: 100%; }
    
    .list-item { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .list-item-actions { width: 100%; justify-content: flex-end; }
}
