/* ==========================================================================
   MicroProject Portal - Modern CSS Design System & Stylesheet
   ========================================================================== */

:root {
    /* Color Palette - Dark Theme Defaults */
    --bg-base: #0b0f19;
    --bg-surface: #111827;
    --bg-card: rgba(31, 41, 55, 0.65);
    --bg-glass: rgba(17, 24, 39, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.3);
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Brand Accents */
    --color-primary: #6366f1; /* Indigo */
    --color-primary-hover: #4f46e5;
    --color-success: #10b981; /* Emerald */
    --color-warning: #f59e0b; /* Amber */
    --color-danger: #ef4444;  /* Red */
    --color-info: #3b82f6;    /* Blue */
    --color-purple: #8b5cf6;  /* Purple */
    
    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 16px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-base: #f3f4f6;
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.4);
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.15);
}

/* --- Global Resets & Typography --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.25;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

.hidden {
    display: none !important;
}

/* --- Glassmorphism Panels --- */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 280px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    border-left: 4px solid var(--color-primary);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out forwards;
}

.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- Auth Login Screen --- */
.auth-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 30%, rgba(99, 102, 241, 0.15), transparent 70%), var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 5000;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 36px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    margin-bottom: 14px;
    box-shadow: var(--shadow-glow);
}

.auth-header h2 {
    font-size: 24px;
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 13px;
}

.demo-accounts-box {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.demo-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.demo-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* --- Buttons & Inputs --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-glow);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
}
.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.35);
}

.btn-danger-soft {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.btn-danger-soft:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
}
.btn-danger-soft.disabled, .btn-danger-soft:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}
.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--border-highlight);
}

.form-control-sm { padding: 6px 10px; font-size: 12px; }

.form-row {
    display: flex;
    gap: 12px;
}
.col-6 { flex: 1; }
.col-4 { flex: 1; }

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

/* Sidebar */
.sidebar {
    width: 260px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-radius: 0;
    border-right: 1px solid var(--border-color);
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    display: block;
}

.brand-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

.sidebar-nav {
    padding: 20px 12px;
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    padding: 12px 12px 6px 12px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 4px;
}

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

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

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

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--color-primary);
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
}

/* Topbar Header */
.main-wrapper {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 70px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    border-radius: 0;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 20px;
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    position: relative;
    width: 240px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.search-box input {
    padding-left: 34px;
}

.content-container {
    padding: 30px;
    flex: 1;
}

/* --- Dashboard Elements --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.metric-card {
    padding: 20px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

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

.metric-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.metric-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.icon-indigo { background: rgba(99, 102, 241, 0.15); color: var(--color-primary); }
.icon-emerald { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.icon-purple { background: rgba(139, 92, 246, 0.15); color: var(--color-purple); }

.metric-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 6px;
}

.metric-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.col-span-8 { grid-column: span 8; }
.col-span-4 { grid-column: span 4; }

.panel {
    padding: 24px;
    border-radius: var(--radius-md);
}

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

.panel-header h3 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Progress List */
.projects-progress-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.project-progress-item {
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.project-progress-item:hover {
    border-color: var(--color-primary);
}

.project-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.project-item-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-success));
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* Milestones Timeline */
.milestones-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.milestone-card {
    padding: 12px 14px;
    background: var(--bg-surface);
    border-left: 3px solid var(--color-warning);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.milestone-info {
    flex: 1;
}

.milestone-title {
    font-weight: 600;
    font-size: 13px;
}

.milestone-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary { background: rgba(99, 102, 241, 0.2); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-secondary { background: rgba(156, 163, 175, 0.2); color: #d1d5db; }
.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }
.badge-pill { border-radius: var(--radius-full); }

/* --- Kanban Task Board --- */
.filter-bar {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.kanban-board-wrapper {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 20px;
}

.kanban-column {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

.column-header {
    padding: 12px 16px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.status-backlog { border-top: 3px solid var(--text-muted); }
.status-todo { border-top: 3px solid var(--color-info); }
.status-in_progress { border-top: 3px solid var(--color-warning); }
.status-in_review { border-top: 3px solid var(--color-purple); }
.status-done { border-top: 3px solid var(--color-success); }

.column-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.task-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.task-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.task-code {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
}

.task-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.task-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 11px;
    color: var(--text-muted);
}

.task-assignee-avatar {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
}

/* --- Audit Log Feed --- */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    gap: 14px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.activity-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.activity-content {
    flex: 1;
}

.activity-summary {
    font-size: 13px;
    line-height: 1.4;
}

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.activity-diff {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    color: #34d399;
}

/* --- Workspace Folders & Projects Grid --- */
.folders-projects-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.folder-block {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

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

.folder-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.folder-color-badge {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.project-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: var(--transition);
}

.project-card:hover {
    border-color: var(--color-primary);
}

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

.modal-card {
    width: 100%;
    max-width: 540px;
    padding: 24px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-lg { max-width: 800px; }

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

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.modal-detail-grid {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 24px;
}

/* Comments */
.comments-feed {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 10px;
}

.comment-bubble {
    padding: 10px 14px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* Utility Helpers */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.mb-4 { margin-bottom: 20px; }
.ml-auto { margin-left: auto; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }

.text-indigo { color: var(--color-primary); }
.text-emerald { color: var(--color-success); }
.text-amber { color: var(--color-warning); }

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.table th, .table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
}
