/* --- Reset Básico e Configuração Global --- */
:root {
    --primary-text: #E0E0E0;
    --dark-bg: #101010;
    --surface-bg: #1a1a1a;
    --green-call: #25D366;
    --red-hangup: #FF3B30;
    --button-size: 70px;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--dark-bg);
    color: var(--primary-text);
    min-height: 100%;
    overflow: auto;
}

* {
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    flex-direction: column;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 1;
}

.screen.active {
    display: flex;
    z-index: 2;
}

#app-container {
    visibility: hidden;
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
}

#app-container.initialized {
    visibility: visible;
}

.error-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #0f0f0f 100%);
}

.error-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    margin: 0 20px;
}

.error-container h2 {
    color: #ff6b6b;
    margin-bottom: 1rem;
    font-size: 1.5em;
}

.error-container p {
    color: white;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.error-container button {
    background: linear-gradient(145deg, #666, #555);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.error-container button:active {
    transform: translateY(2px);
}

.ramais-container {
    padding: 0;
    flex-shrink: 0;
    margin-bottom: 12px;
}

.ramais-container h4 {
    color: var(--primary-text);
    margin: 0 0 8px 0;
    font-size: 0.9em;
    font-weight: 600;
}

.ramais-scroll {
    max-height: 156px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ramal-line {
    padding: 9px 12px;
    color: var(--primary-text);
    font-size: 0.9em;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s ease;
}

.ramal-line:last-child {
    border-bottom: none;
}

.ramal-line:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ramal-line:active {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0.98);
}

/* --- Tela de Boas Vindas --- */
#welcome-screen {
    background: var(--dark-bg);
    padding: 0;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    position: relative;
}

.welcome-brand {
    padding: 65px 20px 20px;
    z-index: 1;
    position: relative;
}

.welcome-brand h1.condominium-name {
    font-size: 2.2em;
    font-weight: 700;
    margin: 0;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.welcome-brand .brand-logo {
    max-height: 80px;
    max-width: 300px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.welcome-footer {
    padding: 30px;
    z-index: 1;
    position: relative;
    text-align: center;
}

.welcome-footer p {
    font-size: 0.9em;
    font-weight: 400;
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.5px;
}

.welcome-greeting {
    padding: 16px 20px;
    z-index: 1;
    position: relative;
}

.welcome-greeting p:first-child {
    font-size: 1.8em;
    font-weight: 600;
    margin: 0;
    color: #ffffff;
}

.greeting-subtitle {
    font-size: 1.2em;
    font-weight: 400;
    margin: 5px 0 0 0;
    color: rgba(255, 255, 255, 0.85);
}

.welcome-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 30px 40px;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    z-index: 1;
    position: relative;
}

.welcome-options span { 
    font-weight: normal;
    color: white;
}

.option-btn {
    width: 100%;
    height: 70px;
    border-radius: 40px;
    border: 2px solid;
    background: rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(10px);
    color: #2e2e2e;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 8px 24px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 24px;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.option-btn i {
    font-size: 1.5em;
    z-index: 1;
}

.option-btn span {
    z-index: 1;
    flex: 1;
    text-align: left;
}

.option-delivery {
    border-color: rgba(255, 59, 48, 0.6);
}

.option-delivery i {
    color: #fa465e;
}

.option-service {
    border-color: rgba(0, 122, 255, 0.6);
}

.option-service i {
    color: #00a3e4;
}

.option-package {
    border-color: rgba(52, 199, 138, 0.6);
}

.option-package i {
    color: #05e6db;
}

.option-visitor {
    border-color: rgba(20, 184, 166, 0.6);
}

.option-visitor i {
    color: #14b8a6;
}

.option-other {
    border-color: rgba(255, 204, 0, 0.6);
}

.option-other i {
    color: #fba300;
}

.option-btn:active {
    transform: translateY(2px);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

#dialer-screen {
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
    justify-content: space-between;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 45%;
    margin-right: 30px;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-text);
    font-size: 1.1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.back-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(0.9);
}

.header {
    text-align: center;
    padding: 5px 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-left: 1.15em;
}

.header h1{
    margin-bottom: 0.45em;
}

#status {
    font-size: 0.9em;
    color: #999;
    min-height: 20px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

.modal.fade-out {
    opacity: 0;
}

.modal-content {
    background-color: var(--surface-bg);
    margin: 75% auto 0;
    padding: 2em;
    border: 1px solid #444;
    width: 70%;
    max-width: 350px;
    text-align: center;
    border-radius: 12px;
    color: var(--primary-text);
    position: relative;
}

.error-icon {
    font-size: 2.5em;
    color: #e74239;
    margin-bottom: 8px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--primary-text);
}

#location-modal .modal-content {
    text-align: center;
}

#location-retry-btn {
    background: linear-gradient(145deg, #666, #555);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    margin: 15px auto 0;
    display: block;
    transition: all 0.3s ease;
}

#location-retry-btn:active {
    transform: translateY(2px);
}


#status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
}

#status-dot.pulsating::before {
    content: '';
    position: absolute;
    display: block;
    width: 300%;
    height: 300%;
    box-sizing: border-box;
    margin-left: -100%;
    margin-top: -100%;
    border-radius: 45px;
    background-color: #01a4e9;
    animation: pulse-ring 1.25s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

#status-dot.pulsating::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    display: block;
    width: 100%;
    height: 100%;
    background-color: rgb(27, 255, 38);
    border-radius: 15px;
    box-shadow: 0 0 8px rgba(0,0,0,.3);
    animation: pulse-dot 1.25s cubic-bezier(0.455, 0.03, 0.515, 0.955) -.4s infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(.33); }
    80%, 100% { opacity: 0; }
}

@keyframes pulse-dot {
    0% { transform: scale(.8); }
    50% { transform: scale(1); }
    100% { transform: scale(.8); }
}

.dialer-ui {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex-grow: 1;
    padding-top: 16px;
}

.display-container {
    text-align: center;
    margin: 16px 0;
}

#phone-number-display {
    width: 100%;
    font-size: 2em;
    background: none;
    border: none;
    color: var(--primary-text);
    text-align: center;
    padding: 10px 0;
    box-sizing: border-box;
}

#dialpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.dialpad-btn {
    width: var(--button-size);
    height: var(--button-size);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(145deg, var(--surface-bg), #1f1f1f);
    color: var(--primary-text);
    font-size: 1.8em;
    justify-self: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 8px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.dialpad-btn:active {
    transform: translateY(2px);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.call-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 0;
    gap: 30px;
}

.call-btn, .hangup-btn {
    width: var(--button-size);
    height: var(--button-size);
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.call-btn {
    background: linear-gradient(145deg, var(--green-call), #0f8a0f);
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 8px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.6s ease;
}

.call-btn i {
    font-size: 1.8em;
    color: white;
}

.call-btn:active {
    transform: translateY(2px);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.call-btn.disabled {
    background: linear-gradient(145deg, #555, #333);
    opacity: 0.6;
}

/* --- Tela de Chamada --- */
#calling-screen {
    background-color: #000;
    justify-content: space-around;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.call-info {
    margin-top: 20%;
    position: relative;
    z-index: 1;
}

.call-info.ongoing::before,
.call-info.ongoing::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    pointer-events: none;
}

.call-info.ongoing::before {
    background: radial-gradient(circle, rgba(37, 211, 102, 0.6) 0%, rgba(37, 211, 102, 0.3) 40%, transparent 70%);
    animation: pulse-ring-layer-1 2s infinite ease-out;
}

.call-info.ongoing::after {
    background: radial-gradient(circle, rgba(37, 211, 102, 0.5) 0%, rgba(37, 211, 102, 0.2) 50%, transparent 80%);
    animation: pulse-ring-layer-2 2s infinite ease-out;
    animation-delay: 0.6s;
}

@keyframes pulse-ring-layer-1 {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

@keyframes pulse-ring-layer-2 {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

#calling-number {
    font-size: 3em;
    margin: 0;
}

#calling-status {
    font-size: 1.2em;
    color: #bbb;
}

.mute-btn, .hangup-btn {
    margin-bottom: 20%;
    width: var(--button-size);
    height: var(--button-size);
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 8px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.hangup-btn {
    background: linear-gradient(145deg, var(--red-hangup), #cc2f26);
}

.mute-btn {
    background: linear-gradient(145deg, #666, #555);
}

.mute-btn i, .hangup-btn i {
    font-size: 1.8em;
    color: white;
}

.mute-btn.muted {
    background: linear-gradient(145deg, #ffffff, #e0e0e0);
}

.mute-btn.muted i {
    color: #000;
}

.mute-btn:active, .hangup-btn:active {
    transform: translateY(2px);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.calling-animation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    height: 50px;
}

.calling-animation span {
    width: 1.5em;
    height: 1.5em;
    border-radius: 50%;
    animation: pulse 1.5s infinite ease-in-out;
}
.calling-animation span:nth-child(1) { background-color: #DDD6FE; animation-delay: -0.3s; }
.calling-animation span:nth-child(2) { background-color: #A44DEB; animation-delay: -0.15s; }
.calling-animation span:nth-child(3) { background-color: #8B5CF6; }
.calling-animation span:nth-child(4) { background-color: #C084FC; animation-delay: 0.15s; }

@keyframes pulse {
    0%, 80%, 100% {
        transform: scale(0.5);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

#log-section {
    padding: 0 20px 20px 20px;
}
#log-console {
    border: 1px solid #ccc;
    background-color: #F0F0F0;
    color: #333;
    height: 100px;
    overflow-y: scroll;
    padding: 5px;
    font-family: monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    border-radius: 4px;
}

#desktop-blocked-screen {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #0f0f0f 100%);
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

#desktop-blocked-screen::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.desktop-blocked-content {
    position: relative;
    z-index: 1;
    max-width: 500px;
    margin: 0 auto;
}

.desktop-blocked-icon {
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.desktop-blocked-text h2 {
    font-size: 2.2em;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #ffffff;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.desktop-blocked-text p {
    font-size: 1.2em;
    font-weight: 400;
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

.option-btn,
.dialpad-btn,
.call-btn,
.hangup-btn,
.mute-btn,
.back-btn {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
