@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

/* Reset e configurações base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Background com gradiente moderno */
html, body {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    background-attachment: fixed;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
    overflow-x: hidden;
}

body {
    text-align: center;
    position: relative;
    padding: 20px;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* Permitir seleção em inputs */
input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* Efeito de particles no fundo */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

/* Glassmorphism containers */
.form-signin {
    max-width: 900px;
    margin: 0 auto;
}

#webphone_body {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#webphone_body:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Display principal */
#webphone_display {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

#webphone_display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

#webphone_display h4 {
    font-weight: 600;
    font-size: 1.4rem;
    letter-spacing: 0.5px;
    margin: 0;
}

/* Inputs modernos */
.form-control {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #ffffff;
    padding: 14px 20px;
    font-size: 15px;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
    margin-bottom: 16px;
}

.form-control:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Campo de discagem - apenas quando visível */
#ext:not([type="hidden"]) {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(99, 102, 241, 0.4);
    border-radius: 16px;
    color: #ffffff;
    font-size: 28px;
    font-weight: 600;
    font-family: 'Space Mono', monospace;
    text-align: center;
    padding: 16px;
    letter-spacing: 4px;
}

/* Botões base */
.btn {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    border: none;
    border-radius: 12px;
    padding: 12px 28px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: none;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.96);
}

/* Botão primário */
.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

/* Botão sucesso */
.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

/* Botão danger/hangup */
.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

/* Botão warning */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

/* Botão default (teclado numérico) */
.btn-default {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 24px;
    font-weight: 600;
    font-family: 'Space Mono', monospace;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-default:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-default:active {
    background: rgba(99, 102, 241, 0.3);
}

/* Tamanhos específicos dos botões - respeitando estilos inline */
.btn-lg {
    /* Removido: width e height definidos inline no HTML */
    border-radius: 12px;
}

.btn-md {
    padding: 14px 36px;
    font-size: 16px;
}

.btn-sm {
    padding: 10px 24px;
    font-size: 14px;
}

/* Keypad containers */
#webphone_keypad {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    margin: 8px;
}

#webphone_keypad_right {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px 16px;
    margin: 8px;
}

/* Tabelas de configuração avançada */
table {
    width: 100%;
    margin: 16px 0;
}

table input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #ffffff;
    padding: 10px 14px;
    font-size: 14px;
    width: 100%;
}

table td {
    padding: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

/* Loading screen */
#hideAll {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 100%);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hideAll h2 {
    font-size: 1.8rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Status e informações */
.inner {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    margin-top: 24px;
}

.inner i {
    font-style: normal;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
}

/* Animação de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-signin-content {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    body {
        padding: 8px;
        font-size: 14px;
    }
    
    .container {
        padding: 0;
        max-width: 100%;
    }
    
    #webphone_body {
        padding: 16px;
        border-radius: 16px;
        max-width: 100%;
        margin: 0 auto;
    }
    
    /* Botões do teclado DTMF */
    .btn-lg {
        width: 60px !important;
        height: 60px !important;
        font-size: 22px !important;
        margin-bottom: 8px !important;
        margin-right: 6px !important;
    }
    
    /* Botões de ação (Dial, Clear, etc) */
    .btn-sm[style*="width: 72px"],
    .btn-sm[style*="width:72px"] {
        width: 80px !important;
        padding: 10px 6px !important;
        font-size: 13px !important;
    }
    
    /* Botões laterais */
    .btn-sm[style*="width: 120px"],
    .btn-sm[style*="width:120px"] {
        width: 100% !important;
        max-width: 140px;
        padding: 10px 8px !important;
        font-size: 13px !important;
        margin-bottom: 10px !important;
    }
    
    /* Display de extensão */
    #ext {
        font-size: 28px !important;
        letter-spacing: 3px;
    }
    
    /* Display principal */
    #webphone_display {
        padding: 20px 16px;
        min-height: 120px;
    }
    
    #webphone_display h2 {
        font-size: 18px !important;
    }
    
    #webphone_display h4 {
        font-size: 16px !important;
    }
    
    /* Inputs */
    input.form-control {
        font-size: 16px !important;
        padding: 12px !important;
    }
    
    #calling_input {
        max-width: 95% !important;
        font-size: 14px !important;
    }
    
    /* Badge de status */
    #whoami {
        font-size: 13px !important;
        padding: 6px 14px;
        max-width: 95%;
    }
    
    /* Coluna do keypad direito */
    #webphone_keypad_right {
        margin-top: 20px;
    }
    
    #webphone_keypad_right .btn {
        width: 100% !important;
        max-width: 200px;
        margin: 0 auto 10px auto !important;
        display: block;
    }
    
    /* Ajustes de grid Bootstrap */
    .col-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xl-6 {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .col-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xl-4 {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* Mobile pequeno (até 480px) */
@media (max-width: 480px) {
    body {
        padding: 4px;
    }
    
    #webphone_body {
        padding: 12px;
        border-radius: 12px;
    }
    
    /* Botões DTMF menores */
    .btn-lg {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
        margin-bottom: 6px !important;
        margin-right: 4px !important;
    }
    
    /* Botões de ação menores */
    .btn-sm[style*="width: 72px"],
    .btn-sm[style*="width:72px"] {
        width: 70px !important;
        padding: 8px 4px !important;
        font-size: 12px !important;
    }
    
    .btn-sm[style*="width: 120px"],
    .btn-sm[style*="width:120px"] {
        width: 100% !important;
        padding: 10px 6px !important;
        font-size: 12px !important;
    }
    
    #ext {
        font-size: 24px !important;
    }
    
    #webphone_display h2 {
        font-size: 16px !important;
    }
}

/* Landscape mobile */
@media (max-width: 900px) and (orientation: landscape) {
    #webphone_body {
        padding: 12px;
    }
    
    .btn-lg {
        width: 50px !important;
        height: 50px !important;
        font-size: 18px !important;
    }
    
    #webphone_display {
        padding: 16px;
        min-height: 100px;
    }
}

/* PWA Standalone mode adjustments */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Estados de foco visíveis para acessibilidade */
button:focus-visible, 
input:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.8);
    outline-offset: 2px;
}

/* Transições suaves globais */
* {
    transition: background-color 0.3s ease, 
                border-color 0.3s ease, 
                box-shadow 0.3s ease;
}

/* Respeitar displays e estilos inline do JavaScript */
[style*="display: none"],
[style*="display:none"] {
    display: none !important;
}

[style*="display: block"],
[style*="display:block"] {
    display: block !important;
}

/* Garantir que width/height inline sejam respeitados */
button[style*="width:"],
button[style*="height:"] {
    /* Estilos inline têm prioridade */
}

/* Ajuste específico para botões do keypad */
#webphone_keypad .btn-lg,
#webphone_keypad .btn-sm {
    font-size: 20px;
    font-weight: bold;
}

/* Efeito de brilho para elementos importantes */
.btn-success, .btn-danger {
    position: relative;
}

.btn-success::after, .btn-danger::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Seleção de texto personalizada */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: white;
}

/* Display de número discado */
#dest_number {
    font-family: 'Space Mono', monospace;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(99, 102, 241, 0.5);
}

/* Badge de status */
#whoami {
    display: inline-block;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Animação para botões de chamada */
@keyframes ring {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(-10deg); }
    20%, 40% { transform: rotate(10deg); }
}

.blinking {
    animation: ring 1s ease-in-out infinite;
}

/* Melhorias para lista de microfones */
#listmic {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

/* Iframe de contatos */
#phonebook {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
}
