/* =========================================
   MOBILE SITE VIEWER - ESTILOS FRONTEND
   Versão: Ultimate 3.0.0
   ========================================= */

/* --- CONTAINER GLOBAL & RESET --- */
.msv-viewer-container {
    margin: 30px auto;
    border: none;
    background: transparent;
    /* Fonte padrão caso a do Google não carregue */
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    position: relative;
    transition: all 0.3s ease;
}

/* Garante que nada estoure a largura do plugin */
.msv-viewer-container *,
.msv-viewer-container *::before,
.msv-viewer-container *::after {
    box-sizing: border-box;
}

/* --- TOOLBAR (CABEÇALHO) --- */
/* A cor de fundo é definida dinamicamente pelo PHP, aqui ficam as dimensões */
.msv-toolbar {
    padding: 25px 30px;
    border-radius: 24px;
    display: flex;
    flex-direction: column; /* Organiza em PILHA (Vertical) */
    gap: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    margin-bottom: 30px;
    position: relative;
    z-index: 10;
}

/* 1. TÍTULO DO APP */
.msv-app-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    line-height: 1.2;
}

/* 2. LINHA DE CONTROLES (Inputs do Meio) */
.msv-controls-row {
    display: flex;
    gap: 15px;
    width: 100%;
    align-items: center;
    flex-wrap: wrap;
}

/* Seletor de Dispositivo */
.msv-device-selector {
    flex: 1;
    min-width: 160px;
}

.msv-device-select {
    width: 100%;
    padding: 12px 18px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 14px;
    background: rgba(255,255,255,0.08); /* Translúcido */
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    appearance: none; /* Remove seta padrão */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
}

.msv-device-select:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.3);
}

.msv-device-select option {
    background: #333; /* Fallback para select nativo */
    color: #fff;
    padding: 10px;
}

/* Input de URL */
.msv-url-input {
    flex: 2;
    display: flex;
    background: rgba(255,255,255,0.08);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
    min-width: 220px;
    transition: all 0.2s;
}

.msv-url-input:focus-within {
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.12);
}

.msv-url-input input {
    flex: 1;
    padding: 12px 18px;
    background: transparent;
    border: none;
    font-size: 14px;
    outline: none;
    width: 100%;
}

/* Placeholder suave */
.msv-url-input input::placeholder {
    opacity: 0.6;
}

/* Botão IR */
.msv-load-url {
    border: none;
    padding: 0 25px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-transform: uppercase;
    transition: filter 0.2s;
    display: flex;
    align-items: center;
}

.msv-load-url:hover {
    filter: brightness(110%);
}

/* 3. LINHA DE AÇÕES (Botões Abaixo) */
.msv-actions-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1); /* Linha divisória sutil */
    flex-wrap: wrap;
}

.msv-actions-row button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50px; /* Redondo (Pill shape) */
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.msv-actions-row button:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.msv-actions-row button .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* --- ÁREA DO DISPOSITIVO (FRAME) --- */
.msv-device-frame {
    padding: 50px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 600px;
    overflow: hidden; /* Importante para animações */
    border-radius: 24px;
    position: relative;
    /* Background definido via PHP inline */
}

/* Wrapper do dispositivo com transição suave */
.msv-device {
    position: relative;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); /* Efeito elástico */
    background: #fff;
    box-shadow: 0 30px 80px rgba(0,0,0,0.3);
    transform-origin: center center;
}

.msv-device-screen {
    background: #fff;
    overflow: hidden;
    position: relative;
    /* Loader enquanto iframe carrega */
    background-image: url("data:image/svg+xml,%3Csvg width='38' height='38' viewBox='0 0 38 38' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg transform='translate(1 1)' stroke-width='2'%3E%3Ccircle stroke-opacity='.5' cx='18' cy='18' r='18' stroke='%23ccc'/%3E%3Cpath d='M36 18c0-9.94-8.06-18-18-18' stroke='%23888' transform='rotate(303.882 18 18)'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 18 18' to='360 18 18' dur='1s' repeatCount='indefinite'/%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.msv-device-screen iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #fff; /* Cobre o loader quando carrega */
}

/* --- ESTILOS DOS MODELOS --- */

/* iPhone 14 Pro Style */
.msv-iphone {
    width: 375px;
    height: 812px;
    border: 12px solid #1a1a1a;
    border-radius: 50px;
    box-shadow: inset 0 0 0 2px #333, 0 40px 80px rgba(0,0,0,0.4);
}
.msv-iphone::before {
    /* Dynamic Island */
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 25px;
    background: #000;
    border-radius: 20px;
    z-index: 10;
}
.msv-iphone .msv-device-screen {
    width: 100%;
    height: 100%;
    border-radius: 38px;
}

/* Samsung Galaxy Style */
.msv-samsung {
    width: 360px;
    height: 760px;
    border: 8px solid #000;
    border-radius: 30px;
    box-shadow: inset 0 0 0 1px #444, 0 30px 60px rgba(0,0,0,0.3);
}
.msv-samsung::before {
    /* Câmera furo */
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: #000;
    border-radius: 50%;
    z-index: 10;
}
.msv-samsung .msv-device-screen {
    width: 100%;
    height: 100%;
    border-radius: 22px;
}

/* Desktop Style */
.msv-desktop {
    width: 100%;
    max-width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
.msv-desktop::before {
    /* Barra de navegador fake */
    content: '';
    display: block;
    height: 30px;
    background: #f3f4f6;
    border-bottom: 1px solid #d1d5db;
    border-radius: 8px 8px 0 0;
}
.msv-desktop .msv-device-screen {
    height: 600px;
}

/* --- ESTADOS (Rotação e Fullscreen) --- */

/* Rotação (Landscape) */
.msv-landscape {
    transform: rotate(90deg);
    margin: 100px 0; /* Espaço extra para não cortar ao girar */
}
/* Desktop não rotaciona */
.msv-desktop.msv-landscape {
    transform: none;
    margin: 0;
}

/* Fullscreen (Tela Cheia) */
.msv-viewer-container.msv-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    margin: 0;
    border-radius: 0;
    background: #fff; /* Fundo padrão do modo fullscreen */
    overflow-y: auto;
}

.msv-viewer-container.msv-fullscreen .msv-toolbar {
    border-radius: 0; /* Toolbar retangular no topo */
    margin-bottom: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.msv-viewer-container.msv-fullscreen .msv-device-frame {
    height: calc(100vh - 160px); /* Ajusta altura */
    border-radius: 0;
    padding: 20px;
}

/* --- RESPONSIVIDADE (Mobile Real) --- */
@media (max-width: 768px) {
    .msv-toolbar {
        padding: 20px;
        gap: 15px;
    }

    .msv-controls-row {
        flex-direction: column; /* Inputs empilhados no mobile */
        align-items: stretch;
    }
    
    .msv-device-selector, 
    .msv-url-input {
        width: 100%;
        min-width: unset;
    }

    .msv-actions-row {
        justify-content: space-between;
    }
    
    .msv-actions-row button {
        padding: 10px 15px;
        flex: 1;
        justify-content: center;
    }
    
    .msv-actions-row button span:not(.dashicons) {
        display: none; /* Esconde texto dos botões em telas muito pequenas */
    }

    /* Ajuste de escala para os celulares caberem na tela do usuário */
    .msv-iphone, .msv-samsung {
        transform: scale(0.7);
        margin: -80px 0; /* Compensa o espaço vazio do scale */
    }
    
    .msv-landscape {
        transform: scale(0.55) rotate(90deg);
        margin: -50px 0;
    }
}

/* --- PROTEÇÃO CONTRA CONFLITOS CSS --- */
/* Força elementos de outros plugins a respeitarem a largura */
.msv-viewer-container input:not(.msv-url),
.msv-viewer-container select:not(.msv-device-select),
.msv-viewer-container textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* Correção específica para Contact Form 7, Elementor e Gravity Forms */
.msv-viewer-container .wpcf7-form-control,
.msv-viewer-container .ginput_container input,
.msv-viewer-container .elementor-field-textual {
    max-width: 100% !important;
}