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

:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --glass-border: rgba(255, 255, 255, 0.1);
    --sidebar-width: 250px;
}

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

body {
    font-family: 'Outfit', 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-main);
    overflow-x: hidden;
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--glass-border);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 50;
}

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

.sidebar-header h2 {
    font-size: 1.5rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

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

.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.topbar {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 40;
}

.breadcrumbs {
    font-size: 0.95rem;
    color: var(--text-muted);
}
.breadcrumbs .crumb { cursor: pointer; transition: color 0.2s; }
.breadcrumbs .crumb:hover { color: var(--primary); }
.breadcrumbs .separator { margin: 0 0.5rem; opacity: 0.5; }

.views-container {
    padding: 2rem;
    position: relative;
    flex: 1;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}
.view.active { display: block; }

.view-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

/* Glassmorphism Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover { box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); }

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-value {
    font-size: 3rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.stat-label { font-size: 1.1rem; color: var(--text-muted); font-weight: 500; }

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    background: var(--card-bg);
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem 1.5rem; text-align: left; border-bottom: 1px solid var(--glass-border); }
th { font-weight: 600; color: var(--text-muted); background: rgba(15, 23, 42, 0.5); text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
tr:hover { background-color: rgba(255, 255, 255, 0.03); }

/* Timeline (Tree) */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 1rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--glass-border);
}
.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -29px; /* offset relative to parent padding */
    top: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 2px solid var(--primary);
    z-index: 1;
}
.timeline-item.done::before {
    background: var(--success);
    border-color: var(--success);
}
.timeline-title { font-weight: 600; font-size: 1.1rem; margin-bottom: 0.3rem; }
.timeline-meta { font-size: 0.85rem; color: var(--text-muted); }

/* Badges & Buttons */
.badge { padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.8rem; font-weight: 600; }
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }

.btn { background: var(--primary); color: white; border: none; padding: 0.5rem 1rem; border-radius: 0.5rem; font-family: inherit; font-weight: 500; cursor: pointer; transition: all 0.2s ease; }
.btn:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2); }
.btn-sm { font-size: 0.8rem; padding: 0.3rem 0.7rem; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: rgba(59, 130, 246, 0.1); }
.btn-link { color: var(--primary); text-decoration: none; font-size: 0.95rem; }
.btn-link:hover { text-decoration: underline; }

/* Modal Styles */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-overlay.active { display: flex; opacity: 1; }

.modal-content {
    background: var(--bg-color);
    width: 100%;
    max-width: 500px;
    padding: 0;
    overflow: hidden;
    animation: fadeInDown 0.3s ease-out;
}

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

.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.3);
}

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-muted); }
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-main);
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
select.form-control { appearance: none; }

.btn-danger { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.btn-danger:hover { background: #ef4444; color: white; }

/* Loader */
.loader-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-color); display: flex; justify-content: center; align-items: center; z-index: 1000; transition: opacity 0.5s ease; }
.spinner { width: 50px; height: 50px; border: 3px solid rgba(59, 130, 246, 0.3); border-radius: 50%; border-top-color: var(--primary); animation: spin 1s ease-in-out infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
    
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 1rem;
        gap: 1rem;
    }
    
    .nav-item {
        white-space: nowrap;
    }
    
    .main-content {
        margin-left: 0;
    }

    .views-container {
        padding: 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }
}
