/* ==========================================================================
   Home Navigator - Web Portal CSS Design Token System & Layouts
   ========================================================================== */

:root {
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --accent-purple: #7c3aed;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-dark: #0f172a;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.5;
    padding-bottom: 60px;
}

/* Login Screen Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.login-overlay.active {
    display: flex;
}

.login-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 36px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: fadeIn 0.3s ease;
}

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

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo {
    font-size: 2.8rem;
    display: block;
    margin-bottom: 8px;
}

.login-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
}

.login-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-group input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.login-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 16px;
}



/* User Session Badge */
.user-badge {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-badge-manager {
    background: #f3e8ff;
    border-color: #d8b4fe;
    color: #6b21a8;
}

/* Header & Navbar */
.navbar {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    font-size: 2rem;
}

.brand-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--text-main);
    display: block;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Quick Stats Bar */
.quick-stats {
    display: flex;
    gap: 12px;
}

.stat-pill {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-weight: 700;
    color: var(--accent-blue);
}

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Main Content Layout */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 20px;
}

/* Search and Filters Section */
.controls-section {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 320px;
    position: relative;
}

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

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: #ffffff;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.search-box input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.filter-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group select {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.filter-group select:focus {
    border-color: var(--accent-blue);
}

/* Systems Grid */
.systems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
}

/* Card Styling */
.system-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.system-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.card-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.system-id-pill {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.health-badge {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.health-high { background: #d1fae5; color: #065f46; }
.health-medium { background: #fef3c7; color: #92400e; }
.health-low { background: #fee2e2; color: #991b1b; }

.system-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 8px;
}

.system-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
}

/* Card Meta Tags */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.tag-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: var(--text-main);
}

.tag-precinct { background: #e0f2fe; color: #0369a1; }
.tag-subdept { background: #f3e8ff; color: #6b21a8; }
.tag-clsfms { background: #fef3c7; color: #92400e; }

/* Links Grid in Card */
.card-links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

/* Button Variants */
.btn {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.82rem;
}

.btn-primary {
    background: var(--accent-blue);
    color: #ffffff;
}

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

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-outline {
    background: #ffffff;
    color: var(--accent-blue);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: var(--accent-blue);
}

.btn-github {
    background: #24292e;
    color: #ffffff;
}

.btn-github:hover {
    background: #000000;
    color: #ffffff;
}

.btn-full {
    width: 100%;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    margin-top: 20px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 6px;
}

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

/* Modal Window */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

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

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-word;
}

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

.hidden {
    display: none !important;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .navbar { padding: 12px 16px; }
    .brand-title { font-size: 1.1rem; }
    .systems-grid { grid-template-columns: 1fr; }
    .controls-section { flex-direction: column; }
    .filter-controls { width: 100%; }
    .filter-group select { width: 100%; }
    .card-links-grid { grid-template-columns: 1fr; }
    .quick-roles-grid { grid-template-columns: 1fr; }
}
