:root {
    --primary: #6d28d9;
    --primary-hover: #5b21b6;
    --primary-light: #8b5cf6;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    --gray-50: #fafafa;
    --gray-100: #f4f4f5;
    --gray-200: #e4e4e7;
    --gray-300: #d4d4d8;
    --gray-400: #a1a1aa;
    --gray-500: #71717a;
    --gray-600: #52525b;
    --gray-700: #3f3f46;
    --gray-800: #27272a;
    --gray-900: #18181b;

    --sidebar-bg: #0f0f12;
    --sidebar-text: #d4d4d8;
    --sidebar-active: var(--primary);
    --sidebar-hover: #1c1c22;

    --border-radius: 8px;
    --box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-900);
    background-color: var(--gray-100);
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar — Dark Theme */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
}

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

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: #e4e4e7;
    font-size: 13px;
}

.user-role {
    font-size: 11px;
    color: #71717a;
}

/* Navigation */
.nav-link {
    display: block;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.15s;
    font-weight: 500;
    font-size: 13px;
    border-left: 3px solid transparent;
}

.nav-link:hover:not(.disabled) {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--primary-light);
}

.nav-link.active {
    background: rgba(109, 40, 217, 0.15);
    color: var(--primary-light);
    border-left-color: var(--primary-light);
}

.nav-link.disabled {
    color: #3f3f46;
    cursor: not-allowed;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 8px 16px;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    background: var(--gray-100);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group textarea,
.form-group select,
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: border-color 0.2s;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    color: var(--gray-600);
    transition: color 0.2s;
}

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

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--box-shadow);
    margin-bottom: 24px;
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 12px;
    text-transform: uppercase;
}

.table tr:hover {
    background: var(--gray-50);
}

.table-actions {
    display: flex;
    gap: 8px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: #ede9fe;
    color: #5b21b6;
}

.badge-secondary {
    background: #e2e8f0;
    color: #475569;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #cffafe;
    color: #155e75;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin: 4px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.3s ease;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

.modal-content.modal-wide {
    max-width: 900px;
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    border-top: 3px solid var(--primary);
}

.stat-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.stat-label {
    color: var(--gray-600);
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--gray-900);
}

/* WBS Tree Styles */
.wbs-task {
    margin-bottom: 8px;
    padding-left: 12px;
}

.wbs-task-header {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.wbs-task-header:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.wbs-code {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary);
    min-width: 60px;
}

.wbs-task-details {
    margin-top: 8px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    font-size: 13px;
}

.wbs-task-details p {
    margin-bottom: 8px;
    color: var(--gray-700);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden {
    display: none !important;
}

/* Loading Spinner */
.spinner {
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-50px);
        opacity: 0;
    }
}


/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar-header,
    .sidebar-footer,
    .nav-link {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .sidebar-title,
    .user-details,
    .nav-divider {
        display: none;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* User Management Styles */
.status-active {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background-color: #d1fae5;
    color: #065f46;
}

.status-inactive {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background-color: #fee2e2;
    color: #991b1b;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background-color: var(--gray-50);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.data-table tbody tr:hover {
    background-color: var(--gray-50);
}

/* Tooltip CSS */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 200;
}
[data-tooltip]:hover::after {
    opacity: 1;
}
