/* TRAXX Client Portal — Styles */

:root {
    --brand-primary: #667eea;
    --brand-secondary: #764ba2;
    --brand-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --brand-light: #f0f0ff;
    --text-dark: #2d3748;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --bg-light: #f7fafc;
    --white: #ffffff;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
}

* { box-sizing: border-box; }

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

/* ── Navbar ─────────────────────────────── */
.portal-navbar {
    background: var(--brand-gradient);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.portal-navbar .brand {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.portal-navbar .nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.portal-navbar .nav-right a,
.portal-navbar .nav-right button {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 0.9rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.portal-navbar .nav-right a:hover,
.portal-navbar .nav-right button:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* Org Switcher */
.org-switcher {
    position: relative;
}

.org-switcher-btn {
    background: rgba(255,255,255,0.15) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    color: white !important;
    padding: 0.4rem 1rem !important;
    border-radius: 6px !important;
    font-size: 0.85rem !important;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.org-switcher-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.4rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    min-width: 250px;
    z-index: 1000;
    overflow: hidden;
}

.org-switcher-dropdown.show { display: block; }

.org-switcher-dropdown a {
    display: block;
    padding: 0.7rem 1rem;
    color: var(--text-dark) !important;
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.org-switcher-dropdown a:hover { background: var(--brand-light); }
.org-switcher-dropdown a.active { background: var(--brand-light); font-weight: 600; }
.org-switcher-dropdown a:last-child { border-bottom: none; }

/* ── Login Page ─────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-gradient);
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.login-card h1 {
    text-align: center;
    color: var(--text-dark);
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-card .logo-mark {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* ── Forms ──────────────────────────────── */
.form-group {
    margin-bottom: 1.2rem;
}

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

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-dark);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.btn {
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    text-decoration: none;
    display: inline-block;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--brand-gradient);
    color: white;
    width: 100%;
}

.btn-primary:hover { opacity: 0.9; }

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

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

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

/* ── Alert ──────────────────────────────── */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

.alert-danger { background: #fff5f5; color: #c53030; border: 1px solid #feb2b2; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.alert-info { background: #ebf8ff; color: #2b6cb0; border: 1px solid #90cdf4; }

/* ── Dashboard Cards ────────────────────── */
.portal-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header .icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.card-header .icon.purple { background: #ede9fe; color: #7c3aed; }
.card-header .icon.blue { background: #dbeafe; color: #2563eb; }
.card-header .icon.green { background: #d1fae5; color: #059669; }
.card-header .icon.orange { background: #ffedd5; color: #ea580c; }

.card-body {
    padding: 1.2rem;
}

/* Links list inside cards */
.link-list { list-style: none; padding: 0; margin: 0; }

.link-list li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
}

.link-list li:last-child { border-bottom: none; }

.link-list a {
    color: var(--brand-primary);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.link-list a:hover { text-decoration: underline; }

.link-list .link-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

/* Recent activity */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-primary);
    margin-top: 0.4rem;
    flex-shrink: 0;
}

.activity-dot.new { background: var(--success); }
.activity-dot.modified { background: var(--warning); }
.activity-dot.deleted { background: var(--danger); }

.activity-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ── Messages ───────────────────────────── */
.message-thread {
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
}

.message-bubble {
    max-width: 75%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.message-bubble.client {
    background: var(--brand-gradient);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-bubble.staff {
    background: #f1f5f9;
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
}

.message-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.message-bubble.client .message-meta { color: rgba(255,255,255,0.7); }

.message-input-area {
    display: flex;
    gap: 0.6rem;
    padding: 1rem 1.2rem;
    border-top: 1px solid var(--border-color);
}

.message-input-area textarea {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
}

/* ── Empty State ────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* ── Responsive ─────────────────────────── */
@media (max-width: 768px) {
    .card-grid { grid-template-columns: 1fr; }
    .portal-content { padding: 1rem; }
    .portal-navbar { padding: 0 1rem; }
    .message-bubble { max-width: 90%; }
}
