/* ============================================================
   Elevator Access Portal — portal.css
   ============================================================ */

/* ---- Base ---- */
* { box-sizing: border-box; }

body.portal-body {
    background: #f0f2f5;
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ---- Navbar ---- */
.portal-navbar {
    background: #1a2332;
    color: #fff;
    padding: 0 20px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.portal-navbar-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.portal-navbar-left {
    display: flex;
    align-items: center;
}

.portal-navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-logo {
    height: 32px;
    margin-right: 12px;
}

.portal-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #fff;
}

.portal-subtitle {
    font-size: 13px;
    color: #8fa3b8;
}

.back-btn {
    color: #8fa3b8;
    font-size: 18px;
    margin-right: 14px;
    text-decoration: none;
    transition: color 0.2s;
}
.back-btn:hover { color: #fff; text-decoration: none; }

/* ---- Main content ---- */
.portal-main {
    padding: 24px 20px;
}

/* ---- Buttons ---- */
.btn-portal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, opacity 0.2s;
}
.btn-portal:hover { opacity: 0.88; text-decoration: none; }

.btn-portal-primary {
    background: #2563eb;
    color: #fff;
}
.btn-portal-primary:hover { color: #fff; }

.btn-portal-secondary {
    background: #374151;
    color: #d1d5db;
}
.btn-portal-secondary:hover { color: #fff; }

/* ---- Status dots & pills ---- */
.status-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-active { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.25); }
.status-idle   { background: #94a3b8; }

.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.status-pill.status-active { background: #dcfce7; color: #166534; }
.status-pill.status-idle   { background: #f1f5f9; color: #475569; }

/* ---- Index: Search ---- */
.elevator-search-wrap {
    margin-bottom: 20px;
}
.elevator-search-group {
    max-width: 420px;
}
.elevator-search-group .input-group-addon {
    background: #fff;
    border: 1px solid #d1d5db;
    border-right: none;
    color: #6b7280;
    padding: 0 12px;
    border-radius: 5px 0 0 5px;
    line-height: 36px;
}
.elevator-search-group .form-control {
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 0 5px 5px 0;
    font-size: 13px;
}

/* ---- Index: Elevator cards ---- */
.elevator-grid { margin: 0 -10px; }
.elevator-card-wrap { padding: 10px; }

.elevator-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, border-color 0.2s;
    overflow: hidden;
}
.elevator-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border-color: #2563eb;
}
.elevator-card.card-active {
    border-left: 4px solid #22c55e;
}

.elevator-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
    border-bottom: 1px solid #f3f4f6;
}
.elevator-status-dot {
    display: flex;
    align-items: center;
    gap: 7px;
}
.status-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.5px;
}
.elevator-ext-badge {
    font-size: 11px;
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.elevator-card-body {
    padding: 14px;
}
.elevator-name {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px;
}
.elevator-branch, .elevator-location {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 4px;
}
.elevator-meta {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}
.meta-item {
    font-size: 12px;
    color: #6b7280;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 3px 8px;
}

.elevator-card-footer {
    padding: 10px 14px 14px;
    display: flex;
    gap: 8px;
}

.no-elevators, .no-search-results {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}
.no-elevators i, .no-search-results i {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

/* ---- Elevator portal page layout ---- */
.elevator-portal-main {
    padding: 16px 16px;
}

.portal-row { margin: 0 -10px; }
.portal-left, .portal-right { padding: 0 10px; margin-bottom: 16px; }

/* ---- Info card ---- */
.info-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 16px;
    overflow: hidden;
}

.info-card-header {
    background: #1a2332;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.info-row {
    display: flex;
    padding: 7px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    align-items: flex-start;
    gap: 10px;
}
.info-row:last-child { border-bottom: none; }

.info-label {
    min-width: 100px;
    color: #6b7280;
    font-weight: 500;
    flex-shrink: 0;
}
.info-value {
    color: #1e293b;
    word-break: break-word;
}
.info-row-desc .info-value { color: #475569; }

.ext-badge {
    background: #eff6ff;
    color: #1d4ed8;
    padding: 2px 10px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
}
.emergency-number {
    color: #dc2626;
    font-weight: 700;
}
.map-link {
    color: #2563eb;
    font-size: 12px;
}

/* ---- Camera card ---- */
.camera-card .info-card-header { justify-content: space-between; }
.camera-count-badge {
    background: rgba(255,255,255,0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.camera-grid {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.camera-item {}

.camera-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cam-live-dot {
    font-size: 8px;
    color: #ef4444;
    animation: blink 1.4s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

.camera-frame-wrap {
    background: #0f172a;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #334155;
}
.camera-frame {
    width: 100%;
    height: 200px;
    display: block;
    border: none;
}

.no-cameras {
    text-align: center;
    padding: 30px 16px;
    color: #94a3b8;
    font-size: 13px;
}
.no-cameras i {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
}

/* ---- Messaging card ---- */
.messaging-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 170px);
    min-height: 480px;
    overflow: hidden;
}

.messaging-header {
    background: #1a2332;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.messaging-elevator-name {
    font-weight: 400;
    color: #94a3b8;
}
.live-indicator {
    margin-left: auto;
    font-size: 11px;
    color: #22c55e;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}
.live-indicator i {
    font-size: 8px;
    animation: blink 1.4s infinite;
}

/* Chat area — reuse app-chat.css structure */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
}

.no-messages {
    text-align: center;
    padding: 40px 16px;
    color: #94a3b8;
    font-size: 13px;
}
.no-messages i {
    font-size: 30px;
    display: block;
    margin-bottom: 8px;
}

/* Override app-chat bubble sizes for portal */
.chat .chat-text {
    max-width: 75%;
}
.chat-time {
    font-size: 10px;
    color: #94a3b8;
    margin-left: 8px;
    white-space: nowrap;
}

/* ---- Message input ---- */
.messaging-input-area {
    border-top: 1px solid #e5e7eb;
    padding: 12px 14px;
    background: #fff;
    flex-shrink: 0;
}

.canned-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.canned-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
    margin: 0;
}
.canned-select {
    flex: 1;
    height: 30px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 12px;
    color: #374151;
    padding: 0 8px;
    cursor: pointer;
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.message-textarea {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    padding: 8px 12px;
    resize: none;
    font-family: inherit;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s;
}
.message-textarea:focus { border-color: #2563eb; }

.send-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background 0.2s;
}
.send-btn:hover { background: #1d4ed8; }
.send-btn:disabled { background: #93c5fd; cursor: not-allowed; }

/* ---- History bar ---- */
.history-bar {
    font-size: 12px;
    color: #94a3b8;
    padding: 8px 4px;
}

/* ---- Navbar status for elevator page ---- */
.nav-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.nav-status-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    margin-left: 6px;
}

/* ---- Toast notification ---- */
.copy-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a2332;
    color: #e2e8f0;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
}
.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.copy-toast i { color: #22c55e; }

/* ---- Not found page ---- */
.not-found-wrap {
    text-align: center;
    padding: 80px 20px;
    color: #64748b;
}
.not-found-wrap i { color: #f59e0b; display: block; margin-bottom: 16px; }
.not-found-wrap h3 { color: #1e293b; margin-bottom: 8px; }
.not-found-wrap p  { margin-bottom: 20px; font-size: 14px; }

/* ---- Standalone chat bubbles (overrides app-chat.css deep nesting) ---- */
#chatArea .chats .chat {
    display: flex;
    justify-content: flex-start;
    margin: 6px 8px;
}
#chatArea .chats .chat.chat-right {
    justify-content: flex-end;
}
#chatArea .chats .chat .chat-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
#chatArea .chats .chat.chat-right .chat-body {
    align-items: flex-end;
}
#chatArea .chats .chat .chat-body .chat-text {
    display: flex;
    margin: 0 0 4px;
}
#chatArea .chats .chat .chat-body .chat-text p {
    padding: 8px 14px;
    background: #fff;
    border-radius: 12px 12px 12px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
    color: #374151;
    font-size: 13px;
    max-width: 420px;
    margin: 0;
    word-break: break-word;
}
#chatArea .chats .chat.chat-right .chat-body .chat-text p {
    background: #2563eb;
    color: #fff;
    border-radius: 12px 12px 0 12px;
}

/* ---- Responsive ---- */
@media (max-width: 991px) {
    .messaging-card { height: 520px; }
}
@media (max-width: 767px) {
    .portal-navbar { height: auto; padding: 10px 14px; flex-direction: column; gap: 6px; }
    .portal-title  { font-size: 15px; }
    .elevator-card-footer { flex-direction: column; }
    .btn-portal { justify-content: center; }
}

/* ---- Call button in navbar ---- */
.btn-portal-call {
    background: #16a34a;
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}
.btn-portal-call:hover  { background: #15803d; }
.btn-portal-call:active { background: #166534; }

/* ---- SIP status dot in navbar ---- */
.sip-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    display: inline-block;
    background: #64748b;
    transition: background 0.3s;
}
.sip-dot.sip-registered { background: #22c55e; }
.sip-dot.sip-idle       { background: #64748b; }
.sip-dot.sip-failed     { background: #ef4444; }
.sip-label {
    font-size: 11px;
    color: #94a3b8;
    margin-right: 4px;
}

/* ---- Floating Call Panel ---- */
.call-panel {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 280px;
    background: #1a2332;
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    z-index: 9999;
    overflow: hidden;
    animation: callPanelIn 0.2s ease;
}
@keyframes callPanelIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.call-panel-header {
    background: #0f172a;
    padding: 14px 16px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}
.call-panel-header .call-panel-icon {
    width: 32px; height: 32px;
    background: #16a34a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.call-panel-icon-ring {
    animation: iconRing 0.6s ease infinite alternate;
}
@keyframes iconRing {
    from { background: #16a34a; transform: scale(1); }
    to   { background: #22c55e; transform: scale(1.15); }
}
.call-panel-ext {
    font-size: 11px;
    color: #64748b;
    margin-left: 2px;
}

.call-panel-status-row {
    padding: 8px 16px 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #94a3b8;
}
#callTimer {
    font-family: monospace;
    font-size: 14px;
    color: #22c55e;
    font-weight: 600;
}

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

/* Call action buttons */
.btn-call {
    flex: 1;
    padding: 9px 0;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s, transform 0.1s;
}
.btn-call:active { transform: scale(0.96); }

.btn-call-hangup {
    background: #dc2626;
    color: #fff;
}
.btn-call-hangup:hover { background: #b91c1c; }

.btn-call-answer {
    background: #16a34a;
    color: #fff;
}
.btn-call-answer:hover { background: #15803d; }

.btn-call-reject {
    background: #64748b;
    color: #fff;
}
.btn-call-reject:hover { background: #475569; }

.btn-call-mute {
    background: #334155;
    color: #e2e8f0;
}
.btn-call-mute:hover   { background: #1e293b; }
.btn-call-muted {
    background: #b45309 !important;
    color: #fff !important;
}
