/**
 * Liaison Portal - CSS Styles
 * Dark theme matching admin panel
 */

/* =====================================================
   CSS Variables - Design Tokens
   ===================================================== */
:root {
    /* Colors - Dark Theme */
    --color-bg-primary: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-tertiary: #334155;
    --color-border: #334155;
    --color-border-light: #475569;

    /* Text Colors */
    --color-text-primary: #e2e8f0;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;

    /* Accent Colors */
    --color-accent: #3b82f6;
    --color-accent-hover: #2563eb;
    --color-success: #10b981;
    --color-success-bg: rgba(16, 185, 129, 0.1);
    --color-warning: #f59e0b;
    --color-warning-bg: rgba(245, 158, 11, 0.1);
    --color-error: #ef4444;
    --color-error-bg: rgba(239, 68, 68, 0.1);
    --color-info: #3b82f6;
    --color-info-bg: rgba(59, 130, 246, 0.1);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 8px;
    --border-radius-sm: 4px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
}

/* =====================================================
   Reset & Base Styles
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent-hover);
}

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

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

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-logo span {
    color: var(--color-accent);
}

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

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-accent);
    border-left-color: var(--color-accent);
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
}

.nav-item-badge {
    margin-left: auto;
    background: var(--color-error);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

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

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

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

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.page-subtitle {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.page-body {
    padding: 2rem;
}

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-primary);
}

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

.stat-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: var(--color-success);
}

.stat-change.negative {
    color: var(--color-error);
}

/* =====================================================
   Task List
   ===================================================== */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.task-item:hover {
    border-color: var(--color-border-light);
}

.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-creator {
    text-decoration: line-through;
}

.task-checkbox {
    margin-right: 1rem;
}

.task-duration {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 1rem;
    min-width: 60px;
    justify-content: center;
}

.task-duration.duration-2 {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.task-duration.duration-5 {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.task-duration.duration-8 {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.task-duration.duration-15,
.task-duration.duration-20 {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-creator {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.task-type {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.task-actions {
    display: flex;
    gap: 0.5rem;
}

.task-notes {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    margin-top: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-bg-tertiary);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--color-accent);
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

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

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

.btn-secondary {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-border);
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-warning {
    background: var(--color-warning);
    color: #1e293b;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
}

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

.btn-info:hover:not(:disabled) {
    background: #2563eb;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border-color: var(--color-text-muted);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
}

/* =====================================================
   Forms
   ===================================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    color: var(--color-text-primary);
    transition: border-color var(--transition-fast);
}

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

.form-input::placeholder {
    color: var(--color-text-muted);
}

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-accent);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.form-error {
    color: var(--color-error);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.radio-label:hover {
    border-color: var(--color-border-light);
}

.radio-label:has(input:checked) {
    border-color: var(--color-accent);
    background: rgba(59, 130, 246, 0.1);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--color-accent);
}

.radio-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.radio-text strong {
    color: var(--color-text-primary);
}

.radio-text .text-muted {
    font-size: 0.875rem;
}

/* =====================================================
   Tables
   ===================================================== */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    background: var(--color-bg-primary);
}

.table tbody tr:hover {
    background: var(--color-bg-tertiary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* =====================================================
   Badges
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.badge-error {
    background: var(--color-error-bg);
    color: var(--color-error);
}

.badge-info {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.badge-neutral {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

.badge-new-assignment {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-weight: 600;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.badge-bootcamp {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

/* =====================================================
   Alerts
   ===================================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: var(--color-success-bg);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

.alert-warning {
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning);
    color: var(--color-warning);
}

.alert-error {
    background: var(--color-error-bg);
    border: 1px solid var(--color-error);
    color: var(--color-error);
}

.alert-info {
    background: var(--color-info-bg);
    border: 1px solid var(--color-info);
    color: var(--color-info);
}

/* =====================================================
   Modals
   ===================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform var(--transition);
}

.modal-backdrop.active .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.25rem;
}

.modal-close:hover {
    color: var(--color-text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* =====================================================
   Progress Bar
   ===================================================== */
.progress {
    height: 8px;
    background: var(--color-bg-tertiary);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--color-accent);
    border-radius: 9999px;
    transition: width var(--transition);
}

.progress-bar.success {
    background: var(--color-success);
}

.progress-bar.warning {
    background: var(--color-warning);
}

.progress-bar.error {
    background: var(--color-error);
}

/* =====================================================
   Utilization Grid (Manager Dashboard)
   ===================================================== */
.utilization-grid {
    display: grid;
    gap: 0.5rem;
}

.utilization-row {
    display: grid;
    grid-template-columns: 200px repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.5rem;
    align-items: center;
}

.utilization-agent {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.utilization-cell {
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
}

.utilization-cell.empty {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
}

.utilization-cell.low {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.utilization-cell.good {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.utilization-cell.high {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.utilization-cell.over {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* =====================================================
   Auth Layout
   ===================================================== */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--color-bg-primary) 0%, #1e293b 100%);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 2rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-logo h1 span {
    color: var(--color-accent);
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-subtitle {
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

/* =====================================================
   Utilities
   ===================================================== */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }

.text-muted { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.hidden { display: none; }

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .page-header {
        padding: 1rem;
    }

    .page-body {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .utilization-row {
        grid-template-columns: 1fr;
    }

    .task-item {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .task-info {
        flex: 1 1 100%;
        order: 1;
    }

    .task-duration {
        order: 0;
    }

    .task-actions {
        order: 2;
        flex: 1 1 100%;
        flex-wrap: wrap;
    }

    .task-actions .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* =====================================================
   Resolution Notes (returned escalations)
   ===================================================== */
.resolution-note {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    border-left: 3px solid #10b981;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.resolution-note strong {
    color: #34d399;
}

/* =====================================================
   Escalation Badge
   ===================================================== */
.badge-escalation {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
    font-weight: 500;
}

