:root {
    --bg-base: #000000;
    --bg-panel: #0a0a0c;
    --bg-btn: #111111;
    --bg-hover: #222222;
    --border: #222222;
    --text-main: #ffffff;
    --text-muted: #888888;
    --primary: #ffffff;
    --primary-inv: #000000;
    --success: #00ff66;
    --danger: #ff3333;
    --rad: 12px;
    --accent: #6d5dfc;
    --accent-glow: rgba(109, 93, 252, 0.4);
}

/* Custom Scrollbar Logic */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.pulse-active {
    animation: pulse-ring 1.5s infinite;
    background: var(--accent) !important;
    color: white !important;
    border: none !important;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 var(--accent-glow);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(109, 93, 252, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(109, 93, 252, 0);
    }
}



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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, sans-serif;
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.4s, color 0.4s;
}


.hidden {
    display: none !important;
}

/* Screens */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

/* =========================================
   SCREEN 1: Minimal Auth
   ========================================= */
.auth-container {
    width: 100%;
    max-width: 380px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand {
    text-align: center;
    margin-bottom: 40px;
}

.brand h1 {
    font-weight: 600;
    font-size: 28px;
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.brand p {
    color: var(--text-muted);
    font-size: 13px;
}

.auth-card {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--rad);
    padding: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    padding: 12px 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.3s;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--text-main);
    border-bottom: 2px solid var(--text-main);
}

.tab-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: center;
}

.input-glass {
    width: 100%;
    padding: 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--rad);
    color: #fff;
    font-size: 24px;
    text-align: center;
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.3s;
}

.input-glass:focus {
    border-color: var(--text-muted);
}

.input-glass::placeholder {
    font-size: 14px;
    letter-spacing: normal;
    text-transform: none;
    color: #444;
}

.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--rad);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

.btn-primary:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

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

.code-display {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--rad);
    padding: 24px;
    margin-bottom: 20px;
    position: relative;
}

#display-code {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: 6px;
}

.btn-icon {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

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

.bar-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    height: 100%;
}

.bar-icon:hover {
    color: var(--text-main);
}


.status-pulse {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 24px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

/* =========================================
   SCREEN 2: Minimalist Chat Dashboard
   ========================================= */
.chat-layout {
    width: calc(100% - 16px);
    max-width: calc(800px - 16px);
    height: calc(100dvh - 16px);
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--rad);
}

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

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    border: 2px solid var(--bg-base);
}

.details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 200px;
    overflow: hidden;
}

.details .name {
    font-weight: 500;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.details .status {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

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

.btn-action {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.btn-action.highlight {
    color: var(--primary-inv);
    background: var(--primary);
    border: none;
}

.btn-action.highlight:hover {
    opacity: 0.8;
}

.btn-action.danger {
    color: var(--danger);
    border-color: rgba(255, 51, 51, 0.2);
}

.btn-action.danger:hover {
    background: rgba(255, 51, 51, 0.1);
}




.chat-messages {
    flex: 1;
    padding: 24px 10%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sys-msg {
    text-align: center;
    margin: 20px 0;
}

.sys-msg span {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.msg {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: var(--rad);
    font-size: 14px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-out {
    align-self: flex-end;
    background: var(--bg-hover);
    color: var(--text-main);
    border-bottom-right-radius: 2px;
}

.msg-in {
    align-self: flex-start;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
}

.chat-input-wrapper {
    padding: 15px;
    border-top: 1px solid var(--border);
}

.input-bar {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

#btn-share-location, #btn-send-message {
    width: 48px;
    height: 48px;
    border-radius: var(--rad);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#btn-send-message {
    background: var(--primary);
    color: var(--primary-inv);
}

#btn-share-location {
    width: 44px;
    height: 44px;
    background: var(--bg-panel);
    color: var(--text-main);
    border: 1px solid var(--border);
}


#btn-share-location:hover, #btn-send-message:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

.input-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.input-container input {
    width: 100%;
    height: 48px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0 44px 0 16px;
    font-size: 14px;
    outline: none;
    border-radius: var(--rad);
    transition: border-color 0.3s;
}


.input-container input:focus {
    border-color: var(--text-muted);
}

#btn-voice-input {
    position: absolute;
    right: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    border-radius: 50%;
}

#btn-voice-input:hover {
    color: var(--text-main);
}

/* Mobile Floating Location Button */
.btn-location-pill {
    display: none;
}

@media (max-width: 600px) {
    #btn-share-location {
        display: none !important;
    }

    .btn-location-pill {
        display: flex;
        align-items: center;
        gap: 6px;
        position: fixed;
        bottom: 90px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--bg-panel);
        border: 1px solid var(--border);
        color: var(--text-main);
        padding: 8px 18px;
        border-radius: 50px;
        font-size: 11px;
        font-weight: 500;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
        z-index: 999;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }





    .btn-location-pill:hover {
        transform: translateX(-50%) scale(1.05);
        background: var(--bg-hover);
        border-color: var(--text-muted);
    }
    
    .btn-location-pill:active {
        transform: translateX(-50%) scale(0.95);
    }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-card {
    text-align: center;
    width: 100%;
    max-width: 320px;
}

.caller-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
}

.modal-card h3 {
    font-size: 16px;
    margin-bottom: 40px;
    font-weight: 400;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.btn-accept,
.btn-decline {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-accept {
    border-color: var(--success);
    color: var(--success);
}

.btn-decline {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-accept:hover {
    background: rgba(0, 255, 102, 0.1);
}

.btn-decline:hover {
    background: rgba(255, 51, 51, 0.1);
}

/* Video Layout */
.call-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: #000;
    overflow: hidden;
}

.video-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.video-container video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
}

.main-remote {
    inset: 0;
    z-index: 1;
}

.local-pip {
    top: 20px;
    right: 20px;
    bottom: auto;
    left: auto;
    width: 120px;
    height: 180px;
    z-index: 5;
    border-radius: var(--rad);
    border: 1px solid #333;
}

.vid-placeholder {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.call-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 20px;
}

.ctrl-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 1px solid #333;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

#ctrl-switch-cam {
    display: none;
}

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

.ctrl-btn.danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}

.ctrl-btn.danger:hover {
    background: rgba(255, 51, 51, 0.1);
}

.ctrl-btn.muted {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.ctrl-btn.muted:hover {
    background: #cc0000;
}

/* Toasts */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-btn);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 12px;
    letter-spacing: 0.5px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 600px) {

    #screen-chat {
        align-items: flex-start;
    }

    .chat-layout {
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        border: none;
        border-radius: 0;
    }

    .chat-messages,
    .chat-input-wrapper {
        padding: 16px;
    }

    .chat-messages {
        padding-bottom: 24px;
    }

    .call-controls {
        width: calc(100% - 20px);
        justify-content: center;
        gap: 10px;
        bottom: 20px;
    }

    .ctrl-btn {
        width: 50px;
        height: 50px;
    }

    #ctrl-switch-cam {
        display: flex;
    }

    .local-pip {
        top: 20px;
        right: 20px;
        bottom: auto;
        left: auto;
        width: 100px;
        height: 150px;
    }
}