@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Cyber-Indigo Palette */
    --accent-indigo: hsl(243, 75%, 59%);
    --accent-indigo-glow: hsla(243, 75%, 59%, 0.4);
    --accent-pink: hsl(330, 81%, 60%);
    --accent-cyan: hsl(190, 90%, 50%);
    
    --bg-deep: hsl(222, 47%, 7%);
    --bg-surface: hsla(222, 47%, 12%, 0.7);
    --bg-sidebar: hsla(224, 47%, 9%, 0.9);
    
    --text-primary: hsl(210, 40%, 98%);
    --text-muted: hsl(215, 20%, 65%);
    --text-dim: hsl(215, 15%, 45%);
    
    --border-light: hsla(255, 255%, 255%, 0.08);
    --border-glow: hsla(243, 75%, 59%, 0.2);
    
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    
    --glass-blur: 24px;
    --card-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.4);
    --transition-smooth: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

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

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

h1, h2, h3, h4, .sidebar-logo {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

/* --- DYNAMIC MESH BACKGROUND --- */
.mesh-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: var(--bg-deep);
    background-image: 
        radial-gradient(at 0% 0%, hsla(243, 75%, 39%, 0.15) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(330, 81%, 40%, 0.1) 0, transparent 50%),
        radial-gradient(at 100% 100%, hsla(190, 90%, 30%, 0.15) 0, transparent 50%),
        radial-gradient(at 0% 100%, hsla(260, 75%, 40%, 0.1) 0, transparent 50%);
    filter: blur(10px);
}

.mesh-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
}

/* --- GLASSMORPHISM SYSTEM --- */
.glass {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-light);
    box-shadow: var(--card-shadow);
}

.glass-hover {
    transition: var(--transition-smooth);
}

.glass-hover:hover {
    background: hsla(222, 47%, 16%, 0.8);
    border-color: var(--border-glow);
    transform: translateY(-4px);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.5), 0 0 20px -5px var(--accent-indigo-glow);
}

/* --- REFINED SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    backdrop-filter: blur(40px);
    border-right: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    padding: 2rem 1.25rem;
    transition: var(--transition-smooth);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    padding: 2rem 0.75rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
    overflow: hidden;
    white-space: nowrap;
    justify-content: flex-start;
}

.logo-icon {
    min-width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-indigo) 0%, #a5b4fc 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 8px 16px var(--accent-indigo-glow);
}

/* --- SIDEBAR FOOTER --- */
.sidebar-footer {
    margin-top: auto;
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: hsla(222, 47%, 4%, 0.3);
}

.user-snippet {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 4px 12px var(--accent-indigo-glow);
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.user-info .username {
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.logout-btn-premium {
    width: 100%;
    background: hsla(0, 100%, 50%, 0.08); 
    border: 1px solid hsla(0, 100%, 50%, 0.1); 
    color: #f87171;
    padding: 0.75rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.logout-btn-premium:hover {
    background: hsla(0, 100%, 50%, 0.15);
    border-color: #ef4444;
    transform: translateY(-2px);
}

.sidebar.collapsed .user-info,
.sidebar.collapsed .logout-btn-premium span {
    display: none;
}

.sidebar.collapsed .sidebar-footer {
    padding: 1rem 0.5rem;
    align-items: center;
}

.sidebar.collapsed .user-snippet {
    justify-content: center;
    padding: 0;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: var(--transition-smooth);
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
}

.nav-item:hover {
    background: hsla(243, 75%, 59%, 0.08);
    color: white;
}

.nav-item.active {
    background: hsla(243, 75%, 59%, 0.12);
    color: white;
    box-shadow: inset 0 0 0 1px hsla(243, 75%, 59%, 0.2);
}

.nav-item svg {
    min-width: 20px;
    transition: var(--transition-smooth);
}

.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-logo h2,
.sidebar.collapsed .user-snippet div,
.sidebar.collapsed .logout-btn span {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.875rem;
}

/* --- MAIN CONTENT & GRID --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 3rem 4rem;
    transition: var(--transition-smooth);
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2.5rem;
}

.nav-card {
    position: relative;
    padding: 2rem;
    border-radius: 20px;
    text-decoration: none;
    color: white;
    overflow: hidden;
}

.nav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, hsla(243, 75%, 59%, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: var(--transition-smooth);
}

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

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: var(--transition-smooth);
}

.nav-card:hover .icon-box {
    transform: scale(1.1) rotate(5deg);
}

/* --- LOGIN SCREEN --- */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    padding: 3rem 2.5rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: hsla(222, 47%, 5%, 0.5);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: var(--transition-smooth);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-indigo);
    background: hsla(222, 47%, 5%, 0.8);
    box-shadow: 0 0 0 4px var(--accent-indigo-glow);
}

/* --- PREMIUM FORMS & INPUTS --- */
.form-label-premium {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Outfit', sans-serif;
}

.input-premium {
    width: 100%;
    background: hsla(222, 47%, 4%, 0.6) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: 12px;
    padding: 0.85rem 1.15rem;
    color: white !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    outline: none;
}

.input-premium:focus {
    background: hsla(222, 47%, 4%, 0.8) !important;
    border-color: var(--accent-indigo) !important;
    box-shadow: 0 0 0 4px var(--accent-indigo-glow);
}

.input-premium::placeholder {
    color: var(--text-dim);
}

.search-premium {
    width: 100%;
    background: hsla(222, 47%, 4%, 0.4);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 1rem 1.25rem 1rem 3.5rem;
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    outline: none;
    backdrop-filter: blur(8px);
}

.search-premium:focus {
    background: hsla(222, 47%, 4%, 0.6);
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 4px var(--accent-indigo-glow);
}

select.input-premium {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
}

/* --- REFINED CARD ACTIONS --- */
.card-action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: hsla(222, 47%, 5%, 0.3);
    border-top: 1px solid var(--border-light);
}

.action-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    background: hsla(255, 255%, 255%, 0.05);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.action-icon-btn:hover {
    background: hsla(243, 75%, 59%, 0.1);
    border-color: var(--accent-indigo);
    color: white;
    transform: translateY(-2px);
}

.action-icon-btn.delete:hover {
    background: hsla(0, 100%, 50%, 0.1);
    border-color: #f87171;
    color: #f87171;
}

/* --- MODAL LAYOUT --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: hsla(222, 47%, 5%, 0.8);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content-premium {
    width: 100%;
    max-width: 520px;
    border-radius: 28px;
    padding: 2.5rem;
    transform: scale(0.95);
    transition: var(--transition-smooth);
}

.modal-overlay.active .modal-content-premium {
    transform: scale(1);
}

.submit-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px var(--accent-indigo-glow);
}

/* --- COMPACT UTILS --- */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active { background: hsla(160, 100%, 40%, 0.1); color: #10b981; border: 1px solid hsla(160, 100%, 40%, 0.2); }
.status-construction { background: hsla(45, 100%, 50%, 0.1); color: #fbbf24; border: 1px solid hsla(45, 100%, 50%, 0.2); }
.status-hidden { background: hsla(0, 0%, 100%, 0.05); color: #94a3b8; border: 1px solid hsla(0, 0%, 100%, 0.1); }

/* Stagger animations for cards */
.stagger-in {
    opacity: 0;
    transform: translateY(20px);
    animation: staggerFade 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

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

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }