/**
 * ============================================================================
 * APIIP Pitch Discussion System - Stylesheet
 * ============================================================================
 *
 * Complete styling for login, two-panel chat layout, admin dashboard,
 * modals, notifications, and responsive design.
 *
 * Matches the prototype at: prototypes/1_discussion_thread.html
 *
 * Table of Contents:
 *   1. CSS Custom Properties
 *   2. Base Reset & Typography
 *   3. Login Page Styles
 *   4. Two-Panel Chat Layout (Investor View)
 *       4a. Pitch Container (Grid Shell)
 *       4b. Sidebar
 *       4c. Chat Area
 *       4d. Messages
 *       4e. Input Area
 *   5. New Pitch Modal
 *   6. Admin View Additions
 *   7. Buttons & Form Utilities
 *   8. Status & Priority Badges
 *   9. Toast Notifications
 *  10. Animations & Keyframes
 *  11. Scrollbar Styling
 *  12. Utility Classes
 *  13. Mobile Responsive
 *  14. Print Styles
 *  15. Analytics Dashboard
 * ============================================================================
 */


/* ============================================================================
   1. CSS CUSTOM PROPERTIES
   ============================================================================ */

:root {
    /* Brand Colors */
    --primary: #667eea;
    --primary-hover: #5a67d8;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Sidebar Palette */
    --sidebar-bg: #2d3748;
    --sidebar-item-bg: #1a202c;
    --sidebar-item-active: #4a5568;
    --sidebar-border-hover: #4a5568;

    /* Chat Area */
    --chat-bg: #f7fafc;

    /* Avatars */
    --admin-avatar: #48bb78;
    --investor-avatar: #667eea;

    /* Admin Bubbles */
    --admin-bubble-bg: #e6fffa;
    --admin-bubble-border: #48bb78;

    /* Status Colors */
    --status-new: #48bb78;
    --status-review: #ed8936;
    --status-response: #4299e1;
    --status-closed: #718096;

    /* Borders & Surfaces */
    --border-color: #e2e8f0;
    --surface-white: #ffffff;
    --surface-light: #f8f9fa;

    /* Text */
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --text-subtle: #718096;

    /* Feedback */
    --success: #48bb78;
    --error: #e53e3e;
    --warning: #ed8936;
    --info: #4299e1;

    /* Typography */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
    --shadow-toast: 0 4px 12px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition: all 0.3s ease;
}


/* ============================================================================
   2. BASE RESET & TYPOGRAPHY
   ============================================================================ */

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

/* Override site-wide decorative .btn::before line from style.css */
.pitch-content-section .btn::before,
.pitch-topbar .btn::before {
    display: none;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: #f5f5f5;
    line-height: 1.5;
}

/* Page wrapper when embedded in site layout (banner, breadcrumb above) */
.pitch-content-section {
    min-height: calc(100vh - 200px);
    background-color: var(--surface-white);
    display: flex;
    flex-direction: column;
    padding-top: 85px; /* Clear the fixed header */
}


/* ============================================================================
   3. LOGIN PAGE STYLES
   ============================================================================ */

/* ---------- Wrapper (centered card on gradient or plain bg) ---------- */
.pitch-login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 40px 20px;
}

.pitch-login-card {
    max-width: 480px;
    width: 100%;
    background: var(--surface-white);
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.pitch-login-card-body {
    padding: 40px;
}

/* ---------- Step Indicator (1-2-3 circles) ---------- */
.login-steps-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
}

.login-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    transition: var(--transition);
}

.login-step-dot.active {
    background: var(--primary);
    transform: scale(1.3);
}

.login-step-dot.completed {
    background: var(--success);
}

/* ---------- Login Step Panels ---------- */
.login-step {
    display: none;
    animation: fadeSlideIn 0.35s ease-out;
}

.login-step.active {
    display: block;
}

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

.login-step h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    text-align: center;
}

.login-step p.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 25px;
}

/* ---------- Login Form Controls ---------- */
.pitch-login-form .form-group {
    margin-bottom: 20px;
}

.pitch-login-form .form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.pitch-login-form .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition);
    background: var(--surface-white);
}

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

.pitch-login-form .form-control.is-invalid {
    border-color: var(--error);
}

.pitch-login-form .invalid-feedback {
    display: block;
    color: var(--error);
    font-size: 13px;
    margin-top: 4px;
}

/* ---------- OTP Input (Step 2) ---------- */
.otp-input {
    font-size: 28px;
    letter-spacing: 14px;
    text-align: center;
    font-weight: 700;
    font-family: 'Courier New', Courier, monospace;
    padding: 14px 20px;
}

.otp-resend {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.otp-resend a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.otp-resend a:hover {
    text-decoration: underline;
}

/* ---------- Remember-Me Checkbox ---------- */
.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.remember-me label {
    cursor: pointer;
    user-select: none;
}

/* ---------- Login Buttons ---------- */
.pitch-login-form .btn-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: var(--surface-white);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pitch-login-form .btn-login:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.pitch-login-form .btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.pitch-login-form .btn-login.btn-success {
    background: var(--success);
}

.pitch-login-form .btn-login.btn-success:hover {
    background: #38a169;
}

/* ---------- Admin Login Link ---------- */
.admin-login-link {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.admin-login-link a {
    color: var(--text-subtle);
    text-decoration: none;
    font-weight: 500;
}

.admin-login-link a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ---------- Login Alert ---------- */
.pitch-login-form .alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.pitch-login-form .alert-danger {
    background: #fff5f5;
    color: var(--error);
    border: 1px solid #fed7d7;
}

.pitch-login-form .alert-success {
    background: #f0fff4;
    color: #276749;
    border: 1px solid #c6f6d5;
}


/* ============================================================================
   4. TWO-PANEL CHAT LAYOUT (INVESTOR VIEW)
   ============================================================================ */

/* ---------- 4a. Pitch Container (Grid Shell) ---------- */
.pitch-container {
    width: 90%;
    max-width: none;
    margin: 0 auto;
    background: var(--surface-white);
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(250px, 300px) 1fr;
    min-height: 60vh;
    height: 80vh;
    max-height: calc(100vh - 140px);
}

/* Wrapper for spacing when inside a page layout */
.pitch-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px;
    background-color: var(--surface-light);
    gap: 20px;
}

/* ---------- 4b. Sidebar ---------- */
.pitch-sidebar {
    background: var(--sidebar-bg);
    color: var(--surface-white);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 2px solid var(--sidebar-item-active);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--surface-white);
}

.sidebar-header p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* New Pitch Button */
.new-pitch-btn {
    background: var(--primary);
    border: none;
    color: var(--surface-white);
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    width: calc(100% - 40px);
    margin: 15px 20px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.new-pitch-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Pitch List */
.pitch-list {
    list-style: none;
    padding: 0 10px 10px;
    flex: 1;
    overflow-y: auto;
}

.pitch-item {
    background: var(--sidebar-item-bg);
    padding: 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.pitch-item:hover {
    background: var(--sidebar-bg);
    border-left-color: var(--primary);
}

.pitch-item.active {
    background: var(--sidebar-item-active);
    border-left-color: var(--primary);
}

.pitch-item-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--surface-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pitch-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pitch-item-snippet {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pitch-item .unread-count {
    background: var(--primary);
    color: var(--surface-white);
    font-size: 10px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---------- 4c. Chat Area ---------- */
.chat-area {
    display: flex;
    flex-direction: column;
    background: var(--chat-bg);
    min-width: 0; /* prevent grid blowout */
    min-height: 0; /* prevent grid item from expanding beyond 80vh */
    overflow: hidden; /* constrain children within grid bounds */
}

#chat-active {
    min-height: 0;
    overflow: hidden; /* ensure flex children stay within bounds */
}

.chat-header {
    background: var(--surface-white);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.chat-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-weight: 700;
}

.chat-header p {
    font-size: 13px;
    color: var(--text-subtle);
    margin: 0;
}

.chat-header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* Empty state when no conversation selected */
.chat-empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.chat-empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.chat-empty-state h4 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.chat-empty-state p {
    font-size: 14px;
    color: var(--text-muted);
}

/* ---------- 4d. Messages ---------- */
.messages-container {
    flex: 1;
    min-height: 0; /* critical: allow shrinking so input-area stays visible */
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--surface-white);
    flex-shrink: 0;
    text-transform: uppercase;
}

.message-avatar.investor,
.message.user .message-avatar {
    background: var(--investor-avatar);
}

.message-avatar.admin,
.message.admin .message-avatar {
    background: var(--admin-avatar);
}

.message-content {
    flex: 1;
    max-width: 70%;
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    gap: 10px;
}

.message-sender {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.message-bubble {
    background: var(--surface-white);
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message.admin .message-bubble {
    background: var(--admin-bubble-bg);
    border-left: 3px solid var(--admin-bubble-border);
}

/* Attachment inside message */
.message-attachments {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.message-attachment-item:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--primary);
}

.message-attachment-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.message-attachment-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.message-attachment-size {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* System messages (status changes, etc.) */
.message-system {
    text-align: center;
    padding: 8px 16px;
    margin: 10px 0;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.message-system span {
    background: var(--surface-light);
    padding: 4px 12px;
    border-radius: 12px;
}

/* Date dividers */
.message-date-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.message-date-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.message-date-divider span {
    position: relative;
    background: var(--chat-bg);
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ---------- 4e. Input Area ---------- */
.input-area {
    background: var(--surface-white);
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition);
    background: var(--surface-white);
}

.message-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

/* Textarea variant for multiline input */
.message-textarea {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 15px;
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition);
    resize: none;
    max-height: 120px;
    min-height: 45px;
    line-height: 1.4;
}

.message-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.attach-btn,
.send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 18px;
    flex-shrink: 0;
}

.attach-btn {
    background: var(--border-color);
    color: var(--text-secondary);
}

.attach-btn:hover {
    background: #cbd5e0;
    color: var(--text-primary);
}

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

.send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
}

/* File preview row (after attaching a file before sending) */
.file-preview-row {
    display: flex;
    gap: 8px;
    padding: 8px 0 0;
    flex-wrap: wrap;
}

.file-preview-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #edf2f7;
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.file-preview-chip .remove-file,
.file-preview-chip .file-preview-remove {
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    transition: var(--transition);
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.file-preview-chip .remove-file:hover,
.file-preview-chip .file-preview-remove:hover {
    color: var(--error);
}


/* ============================================================================
   5. NEW PITCH MODAL
   ============================================================================ */

.new-pitch-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.new-pitch-modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface-white);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 22px;
    color: var(--text-primary);
    font-weight: 700;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition);
    background: var(--surface-white);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.form-group .form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 10px;
}


/* ============================================================================
   6. ADMIN VIEW ADDITIONS
   ============================================================================ */

/* ---------- Admin Topbar ---------- */
.pitch-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background-color: var(--surface-white);
    border-radius: 8px;
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.pitch-topbar-left h4 {
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    font-size: 18px;
}

.pitch-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-topbar {
    background: linear-gradient(135deg, #f8f9fa 0%, var(--surface-white) 100%);
    border-bottom: 3px solid var(--error);
}

.admin-topbar .admin-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff5f5;
    color: var(--error);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---------- Filter Bar (Admin Sidebar Addition) ---------- */
.pitch-filter-bar {
    background-color: var(--surface-white);
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.pitch-filter-bar .filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pitch-filter-bar .filter-group {
    flex: 1;
    min-width: 120px;
}

.pitch-filter-bar label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pitch-filter-bar select,
.pitch-filter-bar input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition);
    background: var(--surface-white);
}

.pitch-filter-bar select:focus,
.pitch-filter-bar input:focus {
    border-color: var(--primary);
}

/* ---------- Investor Detail Card (Admin Chat Header) ---------- */
.admin-investor-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 12px;
}

.admin-investor-card .investor-avatar-lg {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--investor-avatar);
    color: var(--surface-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.admin-investor-card .investor-info h5 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px;
}

.admin-investor-card .investor-info p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* ---------- Admin Controls (Status/Priority Dropdowns) ---------- */
.admin-controls {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 10px;
    align-items: flex-end;
}

.admin-controls .control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-controls label {
    font-weight: 600;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.admin-controls select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition);
    background: var(--surface-white);
    cursor: pointer;
}

.admin-controls select:focus {
    border-color: var(--primary);
}

.admin-controls .btn-update {
    padding: 6px 14px;
    background: var(--primary);
    color: var(--surface-white);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.admin-controls .btn-update:hover {
    background: var(--primary-hover);
}

/* Admin send button accent */
.send-btn.admin-send {
    background: var(--error);
}

.send-btn.admin-send:hover {
    background: #c53030;
    transform: scale(1.05);
}


/* ============================================================================
   7. BUTTONS & FORM UTILITIES
   ============================================================================ */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-family);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

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

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

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

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

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

.btn-success:hover {
    background: #38a169;
}

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

.btn-danger:hover {
    background: #c53030;
}

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

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

.btn-block {
    display: flex;
    width: 100%;
}


/* ============================================================================
   8. STATUS & PRIORITY BADGES
   ============================================================================ */

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--surface-white);
    white-space: nowrap;
}

.status-new {
    background: var(--status-new);
}

.status-review {
    background: var(--status-review);
}

.status-response {
    background: var(--status-response);
}

.status-closed {
    background: var(--status-closed);
}

/* Extended status variants */
.status-open {
    background: var(--info);
}

.status-awaiting {
    background: var(--warning);
}

.status-resolved {
    background: var(--success);
}

/* Priority Badges */
.priority-badge {
    display: inline-block;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.priority-low {
    background: #f7fafc;
    border-color: #cbd5e0;
    color: var(--text-subtle);
}

.priority-normal {
    background: rgba(102, 126, 234, 0.05);
    border-color: var(--primary);
    color: var(--primary);
}

.priority-high {
    background: rgba(237, 137, 54, 0.1);
    border-color: var(--warning);
    color: #c05621;
}

.priority-urgent {
    background: rgba(229, 62, 62, 0.1);
    border-color: var(--error);
    color: var(--error);
}

/* Sector Badge */
.sector-badge {
    display: inline-block;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(118, 75, 162, 0.1);
    color: #764ba2;
    font-weight: 600;
}


/* ============================================================================
   9. TOAST NOTIFICATIONS
   ============================================================================ */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 9999;
    min-width: 280px;
    max-width: 420px;
    box-shadow: var(--shadow-toast);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    animation: toastSlideIn 0.3s ease-out;
    pointer-events: auto;
}

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

.toast-error {
    background: var(--error);
    color: var(--surface-white);
}

.toast-warning {
    background: var(--warning);
    color: var(--surface-white);
}

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

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: var(--transition);
}

.toast-close:hover {
    color: var(--surface-white);
}

/* Toast exit animation */
.toast.toast-exit {
    animation: toastSlideOut 0.3s ease-in forwards;
}


/* ============================================================================
   10. ANIMATIONS & KEYFRAMES
   ============================================================================ */

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

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

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}


/* ============================================================================
   11. SCROLLBAR STYLING
   ============================================================================ */

/* Sidebar scrollbar */
.pitch-sidebar::-webkit-scrollbar,
.pitch-list::-webkit-scrollbar {
    width: 6px;
}

.pitch-sidebar::-webkit-scrollbar-track,
.pitch-list::-webkit-scrollbar-track {
    background: transparent;
}

.pitch-sidebar::-webkit-scrollbar-thumb,
.pitch-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.pitch-sidebar::-webkit-scrollbar-thumb:hover,
.pitch-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages scrollbar */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* ============================================================================
   12. UTILITY CLASSES
   ============================================================================ */

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

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

.text-small {
    font-size: 12px;
}

.loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.skeleton {
    background: linear-gradient(90deg, #edf2f7 25%, #e2e8f0 50%, #edf2f7 75%);
    background-size: 200% 100%;
    animation: pulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ============================================================================
   15. ANALYTICS DASHBOARD
   ============================================================================ */

.analytics-dashboard {
    padding: 0 0 20px 0;
}

/* KPI Cards Row */
.kpi-cards-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.kpi-icon.kpi-total {
    background: rgba(102, 126, 234, 0.12);
}

.kpi-icon.kpi-review {
    background: rgba(237, 137, 54, 0.12);
}

.kpi-icon.kpi-approved {
    background: rgba(72, 187, 120, 0.12);
}

.kpi-icon.kpi-investment {
    background: rgba(159, 122, 234, 0.12);
}

.kpi-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.2;
}

.kpi-label {
    font-size: 13px;
    color: #718096;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.charts-row:has(.chart-card-wide) {
    grid-template-columns: 1.5fr 1fr;
}

.chart-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.chart-card-header {
    padding: 16px 20px 8px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.chart-card-header h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
}

.chart-subtitle {
    font-size: 12px;
    color: #a0aec0;
}

.chart-card-body {
    padding: 8px 16px 16px;
    height: 260px;
    position: relative;
}

/* Responsive: Tablet */
@media (max-width: 1024px) {
    .kpi-cards-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-row,
    .charts-row:has(.chart-card-wide) {
        grid-template-columns: 1fr;
    }
}

/* Responsive: Mobile */
@media (max-width: 640px) {
    .kpi-cards-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .kpi-card {
        padding: 16px;
    }

    .kpi-value {
        font-size: 22px;
    }

    .chart-card-body {
        height: 220px;
    }
}


/* ============================================================================
   13. MOBILE RESPONSIVE
   ============================================================================ */

/* Sidebar toggle button - visible only on mobile */
.sidebar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: var(--surface-white);
    border: none;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--primary-hover);
}

/* Sidebar overlay backdrop on mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
}

.sidebar-overlay.active {
    display: block;
}

/* ---------- Tablet (below 992px) ---------- */
@media (max-width: 991px) {
    .pitch-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 80vh;
    }

    .pitch-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        height: 100%;
        z-index: 999;
        border-radius: 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .pitch-sidebar.show {
        display: flex;
    }

    .sidebar-toggle {
        display: flex;
    }

    .chat-area {
        min-height: 70vh;
    }

    .chat-header {
        padding: 15px 20px;
    }

    .messages-container {
        padding: 20px;
    }

    .input-area {
        padding: 12px 15px;
    }

    /* Admin filter bar stacks */
    .pitch-filter-bar .filter-row {
        flex-direction: column;
        gap: 8px;
    }

    .admin-controls {
        flex-wrap: wrap;
    }
}

/* ---------- Mobile (below 768px) ---------- */
@media (max-width: 768px) {
    .pitch-container {
        border-radius: 0;
        box-shadow: none;
        height: auto;
        min-height: 100vh;
    }

    .pitch-wrapper {
        padding: 10px;
        gap: 10px;
    }

    .pitch-topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 16px;
    }

    .pitch-topbar-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .chat-header h3 {
        font-size: 16px;
    }

    .messages-container {
        padding: 15px;
    }

    .message-content {
        max-width: 85%;
    }

    .message-bubble {
        padding: 10px 14px;
        font-size: 13px;
    }

    .input-area {
        padding: 10px 12px;
    }

    .message-input {
        padding: 10px 16px;
        font-size: 14px;
    }

    .attach-btn,
    .send-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* Modal adjustments */
    .modal-content {
        padding: 20px;
        border-radius: 10px;
        width: 95%;
    }

    .modal-header h3 {
        font-size: 18px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }

    /* Login adjustments */
    .pitch-login-card-body {
        padding: 24px;
    }

    .login-step h3 {
        font-size: 18px;
    }

    /* Admin card stacks */
    .admin-investor-card {
        flex-direction: column;
        text-align: center;
    }

    .admin-controls {
        flex-direction: column;
        gap: 8px;
    }

    .admin-controls .control-group {
        width: 100%;
    }

    .admin-controls select {
        width: 100%;
    }
}

/* ---------- Small Mobile (below 480px) ---------- */
@media (max-width: 480px) {
    .sidebar-header h2 {
        font-size: 16px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 11px;
    }

    .message {
        gap: 8px;
        margin-bottom: 10px;
    }

    .message-sender {
        font-size: 12px;
    }

    .message-time {
        font-size: 10px;
    }

    .message-content {
        max-width: 90%;
    }

    .pitch-login-card-body {
        padding: 20px;
    }

    .otp-input {
        font-size: 22px;
        letter-spacing: 10px;
    }

    .toast {
        left: 10px;
        right: 10px;
        bottom: 10px;
        min-width: auto;
    }
}


/* ============================================================================
   13b. SPINNER ANIMATION
   ============================================================================ */

@keyframes pitchSpin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   14. PRINT STYLES
   ============================================================================ */

@media print {
    .pitch-sidebar,
    .pitch-topbar,
    .input-area,
    .new-pitch-modal,
    .sidebar-toggle,
    .sidebar-overlay,
    .toast,
    .toast-container,
    .new-pitch-btn,
    .attach-btn,
    .send-btn,
    .admin-controls,
    .pitch-filter-bar {
        display: none !important;
    }

    .pitch-container {
        display: block;
        height: auto;
        box-shadow: none;
        border-radius: 0;
    }

    .chat-area {
        background: var(--surface-white);
    }

    .messages-container {
        overflow: visible;
        max-height: none;
        padding: 10px 0;
    }

    .message {
        page-break-inside: avoid;
        animation: none;
    }

    .message-bubble {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}


/* ============================================================================
   15. LOGIN PAGE SPECIFIC STYLES (login.php)
   ============================================================================
   login.php uses its own class names; these map to the design system above.
   ============================================================================ */

.pitch-login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.login-container {
    max-width: 460px;
    width: 100%;
}

.login-card {
    background: var(--surface-white);
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    padding: 40px;
}

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

.login-card-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-card-header p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Override the base .login-step to NOT hide by default on login.php */
.pitch-login-section .login-step {
    display: block;
    animation: fadeSlideIn 0.35s ease-out;
}

/* login.php form controls */
.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.login-card .form-group input[type="email"],
.login-card .form-group input[type="text"],
.login-card .form-group input[type="tel"],
.login-card .form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition);
    background: var(--surface-white);
}

.login-card .form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Password toggle */
.password-wrapper {
    position: relative;
    width: 100%;
}
.password-wrapper input {
    padding-right: 48px !important;
}
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #8896a6;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.password-toggle:hover {
    color: #4a5568;
}
.password-toggle.visible {
    color: var(--primary);
}

/* Remember-me checkbox group */
.remember-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.remember-group .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

.remember-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Primary login button */
.btn-primary-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: var(--surface-white);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary-login:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Admin login button */
.btn-admin-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--error);
    color: var(--surface-white);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-admin-login:hover {
    background: #c53030;
}

.btn-admin-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Button spinner */
.btn-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--surface-white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Login error message */
.login-error {
    padding: 10px 14px;
    border-radius: 8px;
    background: #fff5f5;
    color: var(--error);
    border: 1px solid #fed7d7;
    font-size: 14px;
    margin-top: 16px;
}

/* Login helper text */
.login-helper {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 16px;
}

.login-helper a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.login-helper a:hover {
    text-decoration: underline;
}

/* Step back link */
.step-back {
    margin-bottom: 16px;
}

.step-back a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.step-back a:hover {
    color: var(--primary);
}

/* OTP subtitle */
.otp-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Debug OTP box */
.debug-box {
    background: #fffff0;
    border: 1px solid #fefcbf;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    color: #744210;
    margin-bottom: 16px;
    text-align: center;
}

/* Step subtitle */
.step-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Required/optional labels */
.required {
    color: var(--error);
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 12px;
}

/* Login card footer */
.login-card-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-card-footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
}

.login-card-footer a:hover {
    color: var(--primary);
}

/* Mobile adjustments for login */
@media (max-width: 480px) {
    .login-card {
        padding: 24px;
        border-radius: 10px;
    }

    .login-card-header h3 {
        font-size: 18px;
    }
}
