:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-color: #0F172A;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --footer-bg: rgba(15, 23, 42, 0.9);
    --card-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background-image: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%), radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.1) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: calc(env(safe-area-inset-top) + 90px) 20px 20px 20px;
    padding-bottom: 90px;
    /* Space for footer */
    overflow-x: hidden;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: calc(env(safe-area-inset-top) + 16px) 20px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    border-bottom: 1px solid var(--card-border);
}

.user-initials {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #4f5197b3;
    color: #ffffffe0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 4px 8px rgba(30, 30, 85, 0.3);
    transition: all 0.2s;
}

.user-initials:active {
    transform: scale(0.95);
}

.header-logo {
    height: 24px;
    width: auto;
}

h1 {
    font-size: 1.25rem;
    font-weight: 600;
    /*background: linear-gradient(to right, #818cf8, #c084fc);*/
    -webkit-background-clip: text;
    background-clip: text;
    /*-webkit-text-fill-color: transparent;*/
    color: #94a3b8;
}

.container {
    width: 100%;
    max-width: 480px;
    margin-top: 0;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
}

.content-frame {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 100%;
}

.level-zero-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
    width: 100%;
}

.level-zero-btn {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    padding: 20px 16px;
    border-radius: 5px;
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.level-zero-btn:active {
    transform: scale(0.96);
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
}

.level-zero-btn svg {
    width: 32px;
    height: 32px;
    stroke: var(--primary);
    stroke-width: 2;
    fill: none;
}

.unit-data-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 20px;
    background: rgb(30 41 59);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    min-width: 260px;
    display: none;
    flex-direction: column;
    gap: 12px;
    z-index: 1001;
    animation: fadeInDown 0.3s ease;
}

.unit-data-dropdown.show {
    display: flex !important;
}

.external-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    transition: opacity 0.2s;
}

.external-link:active {
    opacity: 0.7;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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


.unit-badge,
.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
}

.unit-badge svg,
.user-badge svg {
    color: var(--primary);
    flex-shrink: 0;
}

.status-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    max-height: 120px;
    overflow-y: auto;
    padding-right: 4px;
}

.status-list::-webkit-scrollbar {
    width: 4px;
}

.status-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 0;
    color: var(--success);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    animation: slideIn 0.3s ease;
    white-space: nowrap;
}

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

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

.pulse-dot {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
    animation: pulse-slow 2s infinite ease-in-out;
}

.pulse-icon {
    animation: pulse-slow 2s infinite ease-in-out;
    transform-origin: center;
}

@keyframes pulse-slow {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.7;
    }
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.description {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 32px;
    line-height: 1.6;
}

.action-buttons {
    display: grid;
    gap: 16px;
    width: 100%;
}

button {
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: white;
    width: 100%;
}

#acceptBtn {
    background: var(--success);
    box-shadow: 0 8px 16px -4px rgba(16, 185, 129, 0.5);
}

#acceptBtn:active {
    transform: scale(0.98);
    box-shadow: 0 4px 8px -2px rgba(16, 185, 129, 0.5);
}

#declineBtn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

#declineBtn:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

/* Footer Menu */
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--footer-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-around;
    padding: 12px 10px calc(12px + env(safe-area-inset-bottom));
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: color 0.2s;
    flex: 1;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.option-btn:active {
    opacity: 0.7;
}

/* New Active Call Styles */
.call-active-content {
    /*margin-top: 24px;*/
    animation: fadeIn 0.5s ease;
}

.call-image-container {
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--card-border);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.call-active-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s;
}

.dynamic-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.dynamic-options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.list-option-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 14px 20px;
    border-radius: 5px;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
    width: 100%;
    cursor: pointer;
    text-align: left;
    margin-bottom: 15px;
}

.list-option-btn:active {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    transform: translateX(4px);
}

.list-option-btn svg {
    width: 22px;
    height: 22px;
    stroke: var(--primary);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.option-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 20px 24px;
    border-radius: 16px;
    color: var(--text-main);
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    transition: all 0.2s;
    width: 100%;
    cursor: pointer;
}

.option-btn:active {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    transform: translateY(2px);
}

.option-btn svg {
    width: 28px;
    height: 28px;
    stroke: var(--primary);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

#activeHangupBtn {
    background: var(--danger);
    margin-bottom: 20px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

#activeHangupBtn:active {
    transform: scale(0.98);
    background: #dc2626;
}

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

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

.pulse-text {
    animation: pulseRed 1s infinite alternate;
}

@keyframes pulseRed {
    from {
        color: var(--text-main);
    }

    to {
        color: var(--danger);
        text-shadow: 0 0 10px var(--danger);
    }
}

@media (max-width: 380px) {

    .content-frame {
        padding: 24px;
    }

    h1 {
        font-size: 1.75rem;
    }

    .nav-item {
        font-size: 0.65rem;
    }
}

/* Login Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 20px) 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}


.login-modal {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.login-modal h2 {
    margin-bottom: 24px;
    color: var(--text-main);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.form-group input {
    width: 100%;
    padding: 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
}

.login-actions {
    display: grid;
    gap: 12px;
}

#div-fastpass-save {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: row;
    gap: 12px;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    background: var(--footer-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--card-border);
    z-index: 2100;
}

#div-fastpass-save button {
    flex: 1;
    white-space: nowrap;
}


#loginBtn {
    background: var(--primary);
}

#registerBtn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.hidden {
    display: none !important;
}

.modal-footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px calc(20px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
    background: var(--footer-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--card-border);
    z-index: 2100;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.modal-footer-fixed button {
    max-width: 480px;
}


/* Toast Notification */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--primary);
    color: var(--text-main);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.4s 4s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

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

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

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

/* History List Styles */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100dvh - 220px);
    overflow-y: auto;
    margin-top: 16px;
    margin-bottom: 16px;
    padding-bottom: 80px; /* Espaço para o rodapé fixo */
    padding-right: 8px;
    text-align: left;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 12px 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.history-item-label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.history-item-date {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.history-item-user {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
}

.history-status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.status-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.status-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* Messages List Styles */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 450px;
    overflow-y: auto;
    margin-top: 20px;
    margin-bottom: 20px;
    padding-right: 8px;
    text-align: left;
}

.messages-list::-webkit-scrollbar {
    width: 6px;
}

.messages-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.message-item {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.1);
    padding: 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.4s ease;
}

.message-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-item-date {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.message-item-text {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.5;
}

.message-badge {
    padding: 4px 8px;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-loading {
    position: relative !important;
    color: transparent !important;
    pointer-events: none !important;
    opacity: 0.8;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: calc(50% - 10px);
    left: calc(50% - 10px);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

.spinner {
    width: 32px;
    height: 32px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Slider Confirmation */
.slider-container {
    position: relative;
    width: 100%;
    height: 60px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 30px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    cursor: pointer;
}

.slider-track {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-text {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 600;
    pointer-events: none;
    z-index: 1;
}

.slider-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    z-index: 2;
    transition: transform 0.05s ease-out;
    touch-action: none;
}

.slider-thumb svg {
    width: 24px;
    height: 24px;
    stroke: white;
}