/* ==========================================
   VARIABLES & DESIGN SYSTEM
   ========================================== */
:root {
    --bg-primary: #f4f6f9;
    --bg-sidebar: #1e1e2f;
    --bg-card: #ffffff;
    --text-main: #2b2b36;
    --text-muted: #78788c;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --border-color: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-sidebar: #07070f;
    --bg-card: #181824;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: #27273a;
}

/* ==========================================
   RESET & BASE STYLES
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    transition: var(--transition);
    min-height: 100vh;
}

/* ==========================================
   APP LAYOUT STRUCTURE
   ========================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR STYLES */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.sidebar-brand i {
    font-size: 1.75rem;
    color: #6366f1;
}

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

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #a5b4fc;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-menu a:hover, 
.sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-footer {
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
}

/* MAIN BODY & CONTENT CONFIGURATIONS */
.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 2rem;
    max-width: 1400px;
    width: calc(100% - 260px);
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.header-info h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==========================================
   COMPONENTS & UTILITIES
   ========================================== */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* HERO PROGRESS BAR */
.card-hero {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
}

.progress-container {
    margin-top: 1rem;
}

.progress-bar-wrapper {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background-color: #ffffff;
    width: 0%;
    transition: width 0.5s ease-out;
}

/* STATISTICS LAYOUT MAPS */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0;
}

.stat-card i {
    font-size: 2rem;
    padding: 0.75rem;
    border-radius: 10px;
}

.icon-streak { color: var(--warning); background-color: rgba(245,158,11,0.1); }
.icon-commits { color: var(--accent); background-color: rgba(79,70,229,0.1); }
.icon-hours { color: var(--success); background-color: rgba(16,185,129,0.1); }

/* INTERACTION INPUT FORMS & UTILS */
.flex-input {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-card);
    color: var(--text-main);
    outline: none;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
}

.btn-primary {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: var(--border-color);
}

/* CHECKLIST DESIGN MODULES */
.todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.todo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background-color: var(--bg-primary);
    border-radius: 6px;
}

.todo-item.completed span {
    text-decoration: line-through;
    color: var(--text-muted);
}

.btn-del {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
}

/* PROJECT DATA DATA TABLES */
.project-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-high { background-color: rgba(239,68,68,0.1); color: var(--danger); }
.badge-medium { background-color: rgba(245,158,11,0.1); color: var(--warning); }
.badge-low { background-color: rgba(16,185,129,0.1); color: var(--success); }

/* SCRATCHPAD AUTO-SAVE TEXTAREA */
textarea {
    resize: vertical;
    min-height: 100px;
}
.saved-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 0.25rem;
}

/* QUOTES VIEW PORTAL */
.card-quote {
    font-style: italic;
    text-align: center;
    border-left: 4px solid var(--accent);
}
.card-quote span {
    display: block;
    margin-top: 0.25rem;
    font-style: normal;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==========================================
   RESPONSIVE LAYOUT BREAKPOINTS
   ========================================== */
@media (max-width: 992px) {
    .sidebar { width: 70px; padding: 1rem 0.5rem; align-items: center; }
    .sidebar-brand span, .sidebar-menu a span, .sidebar-footer { display: none; }
    .main-content { margin-left: 70px; width: calc(100% - 70px); }
    .project-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
    .main-content { padding: 1rem; }
    .flex-input { flex-direction: column; }
}

/* ==========================================
   ROUTING VIEW STATES
   ========================================== */
.page-view {
    display: none;
    animation: fadeIn 0.25s ease-in-out forwards;
}

.page-view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   GLOBAL DESIGN INTEGRATION & SPECIFIC WRAPPER
   ========================================== */
.main-layout-wrapper {
    margin-left: 260px; /* Sidebar layout padding block */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - 260px);
}

.content-body {
    padding: 2rem;
    flex-grow: 1; /* Pushes footer downwards */
}

/* ==========================================
   NAVBAR / SIDEBAR EXTENSIONS
   ========================================== */
.sidebar-user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    color: var(--text-muted);
}
.sidebar-user-profile i {
    font-size: 1.5rem;
    color: var(--accent);
}

/* ==========================================
   HEADER ACTIONS & STYLES
   ========================================== */
.main-header {
    background-color: var(--bg-card);
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 90;
    transition: var(--transition);
}

/* ==========================================
   GLOBAL FOOTER COMPONENT
   ========================================== */
.main-footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition);
    margin-top: auto;
}

.status-indicator-online {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    margin-right: 2px;
}

/* ==========================================
   RESPONSIVE LAYOUT BREAKPOINTS (MEDIA QUERIES)
   ========================================== */
@media (max-width: 992px) {
    .main-layout-wrapper {
        margin-left: 70px;
        width: calc(100% - 70px);
    }
    .main-header, .main-footer {
        padding: 1rem;
    }
}

/* SPA Active Route Visibility Controllers */
#router-view {
    display: block !important;
    width: 100%;
    min-height: 100%;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

/* Ensure empty dynamic states don't hide structural layouts completely */
.empty-text {
    color: var(--text-muted, #888);
    font-style: italic;
    padding: 1rem 0;
    text-align: center;
    width: 100%;
}