/**
 * IMAC Portal - Styles
 * Minimal, functional design for staff portal
 */

/* =============================================================================
   CSS Variables
   ============================================================================= */
:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-success: #16a34a;
    --color-error: #dc2626;
    --color-warning: #d97706;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

/* =============================================================================
   Base
   ============================================================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 {
    margin: 0 0 1rem;
    font-weight: 600;
}

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

a:hover {
    text-decoration: underline;
}

/* =============================================================================
   Layout
   ============================================================================= */
.container {
    width: 100%;
    max-width: min(1800px, 95%);
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

.container-narrow {
    max-width: 560px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* =============================================================================
   Navigation
   ============================================================================= */
.main-nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-brand a {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);
}

.nav-brand a:hover {
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    flex: 1;
}

.nav-links a {
    color: var(--color-text-muted);
}

.nav-links a:hover {
    color: var(--color-text);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* =============================================================================
   Auth Box (Login, MFA)
   ============================================================================= */
.auth-box {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

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

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--color-text-muted);
    margin: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* MFA Setup */
.mfa-qr {
    text-align: center;
    margin: 1.5rem 0;
}

.mfa-qr img {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.mfa-manual {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.mfa-manual p {
    margin-bottom: 0.5rem;
    color: var(--color-text-muted);
}

.secret-key {
    display: inline-block;
    background: var(--color-bg);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    user-select: all;
}

/* =============================================================================
   Forms
   ============================================================================= */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

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

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

.btn-outline {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover {
    background: var(--color-bg);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* =============================================================================
   Alerts
   ============================================================================= */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

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

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

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

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* =============================================================================
   Cards
   ============================================================================= */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.card p {
    margin: 0;
    color: var(--color-text-muted);
}

/* =============================================================================
   Portal Picker
   ============================================================================= */
.portal-picker {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}

.portal-picker-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.portal-picker-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.4rem;
    color: var(--color-text);
}

.portal-picker-header p {
    color: var(--color-text-muted);
    margin: 0;
    font-size: 0.95rem;
}

.portal-grid {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.portal-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: var(--color-text);
    transition: box-shadow 0.15s, transform 0.1s;
    box-shadow: var(--shadow);
}

.portal-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateX(3px);
    text-decoration: none;
    color: var(--color-text);
}

.portal-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.portal-card-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
}

.portal-card-desc {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.portal-card-arrow {
    color: var(--color-primary);
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 1rem;
}

.portal-picker-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.9rem;
}

/* =============================================================================
   Dashboard Grid
   ============================================================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* =============================================================================
   Page Header
   ============================================================================= */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--color-text-muted);
    margin: 0;
}

/* =============================================================================
   Utilities
   ============================================================================= */
.text-muted {
    color: var(--color-text-muted);
}

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

/* =============================================================================
   Nav Active State
   ============================================================================= */
.nav-links a.active {
    color: var(--color-primary);
    font-weight: 500;
}

/* =============================================================================
   Footer
   ============================================================================= */
.main-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--color-border);
}

.main-footer p {
    margin: 0;
}

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .container {
        padding: 1rem;
    }
}
