/* Staff Portal - Clean Modern Theme */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

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

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

/* Screens */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* Login Screen */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

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

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

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

.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

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

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

.form-group label i {
    margin-right: 8px;
    color: var(--primary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    background: var(--bg-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-block { width: 100%; }
.btn-small { padding: 8px 14px; font-size: 13px; }

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

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: var(--border-color); }

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Error Message */
.error-message {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 12px;
    border-radius: 10px;
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
}

.hidden { display: none !important; }

/* Portal Header */
.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

.header-left h1 {
    font-size: 20px;
    margin-bottom: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

#user-name {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-counsellor { background: var(--primary-light); color: var(--primary); }
.role-peer { background: var(--success-light); color: var(--success); }
.role-admin { background: var(--warning-light); color: var(--warning); }

/* Portal Content */
.portal-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

/* Top Row: Status + Panic */
.top-row {
    margin-bottom: 20px;
}

/* Dashboard Grid Layout - FORCE side by side */
.dashboard-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 24px;
    align-items: start;
}

.dashboard-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0; /* Prevent overflow */
}

/* Urgent column styling - left side for critical items */
.urgent-column .section {
    border-left: 4px solid var(--danger);
}

.urgent-column .livechat-section {
    border-left-color: var(--primary);
}

/* Responsive: Stack on mobile only */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    
    .portal-content {
        padding: 16px;
    }
}

/* Icon button for refresh */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* Status Section */
.status-section {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.status-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.status-buttons {
    display: flex;
    gap: 8px;
}

.status-btn {
    padding: 8px 16px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.status-btn:hover { transform: translateY(-1px); }

.status-btn.available:hover, .status-btn.available.active {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.status-btn.busy:hover, .status-btn.busy.active {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.status-btn.off:hover, .status-btn.off.active {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.current-status {
    margin-left: auto;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Sections */
.section {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header h2 i {
    color: var(--primary);
}

.panic-section {
    border-color: var(--danger);
    border-width: 2px;
}

.panic-section .section-header h2 {
    color: var(--danger);
}

.panic-section .section-header h2 i {
    color: var(--danger);
}

/* Badge */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary);
    color: white;
}

.badge.danger { background: var(--danger); }
.badge:empty { display: none; }

/* Cards List */
.cards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Callback/Alert Card */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-name {
    font-weight: 600;
    font-size: 16px;
}

.card-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.card-status.pending { background: var(--warning-light); color: var(--warning); }
.card-status.in_progress { background: var(--primary-light); color: var(--primary); }
.card-status.active { background: var(--danger); color: white; }
.card-status.acknowledged { background: var(--warning); color: white; }

.card-phone {
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 6px;
}

.card-phone i { margin-right: 6px; }

.card-message {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.card-time {
    color: var(--text-muted);
    font-size: 12px;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.card-actions .btn { flex: 1; }

/* Alert Card */
.alert-card {
    border-left: 4px solid var(--danger);
}

/* Panic Button */
.panic-button {
    width: 100%;
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 32px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
}

.panic-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5);
}

.panic-button:active {
    transform: translateY(0);
}

.panic-button i {
    font-size: 48px;
}

.panic-text {
    font-size: 20px;
    font-weight: 700;
}

.panic-subtext {
    font-size: 14px;
    opacity: 0.9;
}

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

.empty-state i {
    font-size: 32px;
    margin-bottom: 8px;
    color: var(--success);
}

.empty-state p {
    font-size: 14px;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
}

.notification.success { background: var(--success); color: white; }
.notification.error { background: var(--danger); color: white; }
.notification.warning { background: var(--warning); color: white; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Notes Section */
.notes-section .section-header h2 i { color: var(--warning); }

.notes-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.notes-tab {
    padding: 8px 16px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.notes-tab:hover { background: var(--border-color); }
.notes-tab.active { background: var(--primary); color: white; }

.note-card {
    border-left: 4px solid var(--warning);
}

.note-card.shared {
    border-left-color: var(--primary);
}

.note-meta {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.note-meta span {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.note-meta span i { font-size: 11px; }

.note-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.note-badge.private { background: var(--warning-light); color: var(--warning); }
.note-badge.shared { background: var(--primary-light); color: var(--primary); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

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

.modal-header h3 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h3 i { color: var(--warning); }

.modal-close {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover { background: var(--border-color); }

.modal-body { padding: 24px; }

.modal-body textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.modal-body select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-primary);
}

.modal-body select[multiple] {
    height: 100px;
}

.modal-body small {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--bg-primary);
    border-radius: 0 0 16px 16px;
}

/* Responsive */
@media (max-width: 600px) {
    .portal-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .header-right {
        width: 100%;
        justify-content: center;
    }
    
    .status-section {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .status-buttons {
        justify-content: center;
    }
    
    .current-status {
        margin: 0 auto;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .notes-tabs {
        flex-direction: column;
    }
}

/* ============ SAFEGUARDING ALERTS ============ */

.safeguarding-section {
    border: 2px solid var(--danger);
    border-radius: 12px;
    background: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%);
}

.safeguarding-section.has-active {
    animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.safeguarding-section .section-header h2 {
    color: var(--danger);
}

.safeguarding-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(220, 38, 38, 0.1);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--danger);
}

.safeguarding-card {
    border-left: 4px solid var(--danger);
    background: var(--bg-card);
}

.safeguarding-card.active {
    background: linear-gradient(90deg, #fee2e2 0%, var(--bg-card) 20%);
}

.safeguarding-card.acknowledged {
    border-left-color: var(--warning);
    background: linear-gradient(90deg, #fef3c7 0%, var(--bg-card) 20%);
}

.card-session {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.card-trigger {
    margin: 12px 0;
}

.card-trigger label {
    display: block;
    font-size: 12px;
    color: var(--danger);
    font-weight: 600;
    margin-bottom: 6px;
}

.trigger-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.5;
}

.card-ack {
    font-size: 12px;
    color: var(--warning);
    margin-bottom: 8px;
}

.card-ack i {
    margin-right: 4px;
}

/* Risk Level Badges */
.risk-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
}

/* ============ SCREENING SECTION ============ */
.screening-section {
    border: 2px solid var(--warning);
    border-radius: 12px;
    background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
}

.screening-section.has-urgent {
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(217, 119, 6, 0); }
}

.screening-section .section-header h2 {
    color: var(--warning);
}

.screening-card {
    border-left: 4px solid var(--warning);
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.screening-card.urgent {
    border-left-color: var(--danger);
    background: linear-gradient(90deg, #fee2e2 0%, var(--bg-card) 15%);
}

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

.screening-card .card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.screening-card .card-body {
    padding: 12px 16px;
}

.screening-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.screening-time {
    font-size: 12px;
    color: var(--text-muted);
}

.screening-details p {
    margin-bottom: 4px;
    font-size: 14px;
}

.user-message {
    background: #f1f5f9;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
}

.assigned-to, .staff-notes {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 4px;
}

.screening-card .card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.screening-card .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.safeguarding-card.risk-red {
    border-left-color: #dc2626;
    background: linear-gradient(90deg, #fee2e2 0%, var(--bg-card) 15%);
}

.safeguarding-card.risk-amber {
    border-left-color: #f59e0b;
    background: linear-gradient(90deg, #fef3c7 0%, var(--bg-card) 15%);
}

.card-indicators {
    font-size: 12px;
    color: #dc2626;
    margin: 8px 0;
    padding: 8px;
    background: rgba(220, 38, 38, 0.05);
    border-radius: 4px;
}

/* Contact Captured Status */
.contact-captured {
    background: #dcfce7;
    color: #166534;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    margin: 8px 0;
}

.contact-not-captured {
    background: #fef3c7;
    color: #92400e;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    margin: 8px 0;
    border: 1px solid #fcd34d;
}

/* Tracking Information */
.tracking-info {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
}

.tracking-header {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
}

.tracking-header i {
    margin-right: 6px;
    color: #6366f1;
}

.tracking-item {
    font-size: 12px;
    color: #64748b;
    padding: 4px 0;
    word-break: break-all;
}

.tracking-item strong {
    color: #334155;
}

/* Conversation History */
.conversation-history {
    margin: 12px 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    transition: background 0.2s;
}

.history-header:hover {
    background: #e2e8f0;
}

.history-header i:first-child {
    margin-right: 8px;
    color: #6366f1;
}

.history-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: #fff;
}

.history-message {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.history-message.user {
    background: #dbeafe;
    margin-left: 20px;
}

.history-message.assistant {
    background: #f1f5f9;
    margin-right: 20px;
}

.msg-role {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
    color: #64748b;
}

/* Location Info */
.location-info {
    font-size: 13px;
    color: #334155;
    padding: 4px 0;
}

.location-info i {
    width: 20px;
    color: #6366f1;
}

/* Sound Toggle Button */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d3a4d;
    border: 1px solid #3d4f66;
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 12px;
}

.btn-icon:hover {
    background: #3d4f66;
    color: #fff;
}

/* New Alert Banner */
.new-alert-banner {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(220, 38, 38, 0.4);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 10000;
    transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-weight: 600;
    font-size: 16px;
    animation: pulse-glow 1.5s infinite;
}

.new-alert-banner.show {
    top: 20px;
}

.new-alert-banner i {
    font-size: 24px;
    animation: shake 0.5s ease-in-out infinite;
}

.new-alert-banner button {
    background: white;
    color: #dc2626;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
}

.new-alert-banner button:hover {
    transform: scale(1.05);
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 10px 40px rgba(220, 38, 38, 0.4); }
    50% { box-shadow: 0 10px 60px rgba(220, 38, 38, 0.7); }
}

@keyframes shake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Safeguarding card with new alert highlight */
.safeguarding-card.new-alert {
    animation: highlight-new 2s ease-out;
}

@keyframes highlight-new {
    0% { background: rgba(220, 38, 38, 0.3); transform: scale(1.02); }
    100% { background: transparent; transform: scale(1); }
}

/* Location Map */
.location-map {
    height: 200px;
    width: 100%;
    border-radius: 8px;
    margin-top: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.location-map .leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.location-map .leaflet-popup-content {
    font-size: 13px;
    font-family: inherit;
}

/* Live Chat Section */
.livechat-section {
    border-left: 4px solid #3b82f6;
}

.livechat-card {
    border-left: 3px solid #3b82f6;
}

.livechat-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #94a3b8;
    margin: 8px 0;
}

.livechat-meta i {
    color: #3b82f6;
    margin-right: 4px;
}

.livechat-safeguarding {
    background: #fef3c7;
    color: #92400e;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin: 8px 0;
    display: inline-block;
}

.livechat-preview {
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    margin: 8px 0;
}

.livechat-preview label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

.livechat-preview .preview-text {
    font-size: 14px;
    color: #334155;
    font-style: italic;
}

/* Live Chat Modal */
.livechat-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.livechat-modal-content {
    background: #1a2634;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.livechat-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #2d3a4d;
    border-bottom: 1px solid #3d4f66;
}

.livechat-modal-header h3 {
    color: #fff;
    font-size: 18px;
    margin: 0;
}

.livechat-modal-header h3 i {
    color: #3b82f6;
    margin-right: 8px;
}

.livechat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-message.user {
    background: #3b82f6;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.staff {
    background: #2d3a4d;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.msg-sender {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.msg-text {
    color: #fff;
    font-size: 15px;
    line-height: 1.4;
}

.msg-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    align-self: flex-end;
}

.livechat-input {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: #2d3a4d;
    border-top: 1px solid #3d4f66;
}

.livechat-input input {
    flex: 1;
    background: #1a2634;
    border: 1px solid #3d4f66;
    border-radius: 24px;
    padding: 12px 20px;
    color: #fff;
    font-size: 15px;
}

.livechat-input input:focus {
    outline: none;
    border-color: #3b82f6;
}

.livechat-input input::placeholder {
    color: #64748b;
}

.livechat-actions {
    padding: 12px 20px;
    background: #1a2634;
    display: flex;
    justify-content: center;
}

/* New Live Chat Banner */
.new-livechat-banner {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.4);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 10000;
    transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-weight: 600;
    font-size: 16px;
    animation: pulse-glow-blue 1.5s infinite;
}

.new-livechat-banner.show {
    top: 20px;
}

.new-livechat-banner i {
    font-size: 24px;
    animation: shake 0.5s ease-in-out infinite;
}

.new-livechat-banner button {
    background: white;
    color: #3b82f6;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
}

.new-livechat-banner button:hover {
    transform: scale(1.05);
}

@keyframes pulse-glow-blue {
    0%, 100% { box-shadow: 0 10px 40px rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 10px 60px rgba(59, 130, 246, 0.7); }
}

/* Live chat section with waiting chats */
.livechat-section.has-waiting {
    animation: section-pulse 2s infinite;
}

@keyframes section-pulse {
    0%, 100% { border-left-color: #3b82f6; }
    50% { border-left-color: #ef4444; }
}

/* Waiting chat card */
.livechat-card.waiting {
    border-left-color: #ef4444;
    animation: card-pulse 1.5s infinite;
}

@keyframes card-pulse {
    0%, 100% { background: #1e293b; }
    50% { background: rgba(239, 68, 68, 0.15); }
}

/* Flash animation for alerts */
@keyframes flash {
    0%, 100% { background-color: inherit; }
    50% { background-color: rgba(239, 68, 68, 0.2); }
}
/* Last updated: 2026-02-18T17:11:23Z */

/* ============ SIP PHONE STYLES ============ */

/* Phone status indicator */
.phone-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

.phone-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.status-online { color: #16a34a; background: rgba(22, 163, 74, 0.1); }
.status-connecting { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.status-offline { color: #6b7280; background: rgba(107, 114, 128, 0.1); }
.status-error { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

/* Incoming call modal */
.call-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.call-modal.incoming {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.95), rgba(5, 150, 105, 0.95));
}

.call-modal-content {
    background: white;
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.call-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #16a34a, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
    70% { box-shadow: 0 0 0 20px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.caller-name {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
}

.caller-uri {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 30px;
}

.call-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.call-actions .btn-lg {
    padding: 16px 32px;
    font-size: 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.call-actions .btn-success {
    background: #16a34a;
    animation: pulse 2s infinite;
}

.call-actions .btn-danger {
    background: #ef4444;
}

/* Active call panel */
.active-call-panel {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: 16px;
    padding: 16px 24px;
    display: none;
    align-items: center;
    gap: 20px;
    z-index: 9999;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 400px;
}

.call-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.call-info i {
    color: #16a34a;
    font-size: 20px;
}

#call-status {
    font-weight: 600;
}

#call-timer {
    color: #94a3b8;
    font-family: monospace;
    font-size: 16px;
}

.call-controls {
    display: flex;
    gap: 10px;
}

.call-controls .btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #475569;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.call-controls .btn-icon:hover {
    background: #64748b;
}

.call-controls .btn-icon.active {
    background: #ef4444;
}

.call-controls .btn-danger {
    background: #ef4444;
    padding: 12px 20px;
    border-radius: 50px;
}

.call-controls .btn-danger:hover {
    background: #dc2626;
}

/* Phone control in header */
.phone-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.phone-control .btn-call {
    background: #16a34a;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.phone-control .btn-call:hover {
    background: #15803d;
}

.phone-control .btn-call:disabled {
    background: #6b7280;
    cursor: not-allowed;
}

/* Dial pad modal */
.dial-pad-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    z-index: 10001;
    display: none;
}

.dial-pad-modal h3 {
    margin: 0 0 20px;
    text-align: center;
}

.dial-input {
    width: 100%;
    padding: 16px;
    font-size: 24px;
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 20px;
}

.dial-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.dial-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.dial-btn.call {
    background: #16a34a;
    color: white;
    grid-column: span 3;
    width: 100%;
    border-radius: 12px;
    margin-top: 10px;
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}


/* ============ AVAILABILITY/CALENDAR SECTION ============ */

.availability-section {
    border-left: 4px solid #10b981;
}

.availability-section .section-header h2 i {
    color: #10b981;
}

.availability-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.month-display {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 180px;
    text-align: center;
}

.availability-calendar {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.calendar-header span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-card);
    border: 1px solid transparent;
    padding: 4px;
    min-height: 44px;
}

.calendar-day:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.calendar-day.outside {
    opacity: 0.3;
    pointer-events: none;
}

.calendar-day.today {
    background: var(--primary);
    color: white;
}

.calendar-day.today .day-number {
    color: white;
}

.calendar-day.selected {
    background: #10b981;
    color: white;
    border-color: #059669;
}

.calendar-day.selected .day-number {
    color: white;
}

.day-number {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.shift-indicators {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.shift-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.shift-dot.my-shift {
    background: #10b981;
}

.shift-dot.other-shift {
    background: #f59e0b;
}

.availability-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.my-shift {
    background: #10b981;
}

.legend-dot.other-shift {
    background: #f59e0b;
}

.selected-day-panel {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}

.selected-day-panel h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.selected-day-shifts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shift-card-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #10b981;
}

.shift-card-item.other {
    border-left-color: #f59e0b;
}

.shift-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shift-card-name {
    font-weight: 600;
    color: var(--text-primary);
}

.shift-card-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.shift-card-actions {
    display: flex;
    gap: 8px;
}

.empty-shifts {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Mobile responsive for calendar */
@media (max-width: 600px) {
    .calendar-day {
        min-height: 36px;
    }
    
    .day-number {
        font-size: 12px;
    }
    
    .shift-dot {
        width: 5px;
        height: 5px;
    }
    
    .availability-legend {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
}

/* Team On Duty Section */
.team-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.team-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.team-tab {
    padding: 8px 16px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.team-tab.active {
    background: var(--primary);
    color: white;
}

.team-tab:hover:not(.active) {
    background: var(--border);
}

.team-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.team-member.counsellor {
    border-left: 3px solid #22c55e;
}

.team-member.peer {
    border-left: 3px solid #3b82f6;
}

.team-member.is-me {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--primary);
}

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

.team-avatar.counsellor {
    background: #22c55e;
}

.team-avatar.peer {
    background: #3b82f6;
}

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

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

.team-role {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.team-time {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.team-time i {
    margin-right: 4px;
    color: var(--primary);
}

.no-team-text {
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.loading-text {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 10px;
}

/* Swap Request Section */
.swap-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.swap-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.swap-item {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--warning);
}

.swap-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.swap-item-info h4 {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
}

.swap-item-info p {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.swap-item-details {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.swap-item-details i {
    width: 16px;
    margin-right: 4px;
    color: var(--primary);
}

.swap-item-actions {
    display: flex;
    gap: 8px;
}

.swap-item-actions .btn {
    flex: 1;
    padding: 8px;
    font-size: 13px;
}

.request-cover-btn {
    background: var(--warning);
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.request-cover-btn:hover {
    opacity: 0.9;
}

.no-swaps-text {
    text-align: center;
    color: var(--text-muted);
    padding: 16px;
    font-size: 14px;
}
