﻿/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: #0f0f14;
    color: #fff;
    font-weight: 500;
}

/* ========== CONTAINER PRINCIPAL ========== */
.tela-inicial {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background: #12121c;
    overflow: hidden;
}

/* ========== PAINEL DE VALIDAÇÃO ========== */
.validation-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../img/background.png') no-repeat center center;
    background-size: cover;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-panel {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

.center-container {
    width: min(600px, 90vw);
    min-height: 300px;
    background: rgba(20, 20, 40, 0.78);
    border: 2px solid rgba(79, 70, 229, 0.39);
    border-radius: 8px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.validation-title {
    font-size: clamp(20px, 3vw, 24px);
    font-weight: bold;
    color: white;
    margin-bottom: 20px;
    text-align: center;
}

.validation-status {
    font-size: 14px;
    margin-bottom: 15px;
    transition: color 0.3s;
    text-align: center;
}

.progress-bar-container {
    width: min(400px, 90%);
    height: 20px;
    background: #323246;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar {
    height: 100%;
    background: #4f46e5;
    border-radius: 10px;
    transition: width 0.3s ease;
    animation: progressAnimation 1s ease infinite;
}

@keyframes progressAnimation {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}

.validation-details {
    font-size: 11px;
    color: #9696b4;
    text-align: center;
    min-height: 20px;
}

/* ========== APP CONTAINER ========== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #12121c;
}

/* ========== HEADER ========== */
.app-header {
    height: 75px;
    min-height: 75px;
    background: #14141e;
    border-bottom: 1px solid #282837;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.menu-toggle-btn {
    display: none;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #282837;
    border-radius: 6px;
    color: #c8c8dc;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
}

    .menu-toggle-btn:hover {
        background: #232333;
        color: white;
    }

.sidebar-backdrop {
    display: none;
}

.app-title {
    font-size: 20px;
    font-weight: bold;
    color: #6366f1;
    margin: 0;
    line-height: 1.2;
}

/* Versão instalada, ao lado do título — precisa anular o gradiente/background-clip:text do .app-title
   (plano-ativo/plano-inativo) explicitamente, senão o texto do badge também fica "vazado"/transparente. */
.app-versao {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.4rem;
    font-size: 11px;
    font-weight: 600;
    color: #a1a1aa;
    -webkit-text-fill-color: #a1a1aa;
    background: rgba(161, 161, 170, 0.14);
    border: 1px solid rgba(161, 161, 170, 0.35);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    letter-spacing: 0.02em;
}

    /* Plano ativo/inativo (usuario.Produto, ex.: "EDF Editor Ultimate Pass") — degradê verde escuro ao
       verde claro quando o plano está ativo, degradê vermelho quando está inativo/expirado.
       Especificidade ".app-title.plano-ativo" (2 classes) empata com ".tela-inicial .app-title" de
       site.css (também 2 classes) — como site.css carrega DEPOIS de app.css no <head> (Pages/_Host.cshtml),
       ele vencia o empate e devolvia a cor sólida do tema (var(--theme-accent)), apagando o gradiente.
       Prefixando com ".tela-inicial" aqui também (3 classes) garante que este seletor sempre vence, não
       importa a ordem de carregamento. -webkit-text-fill-color é o que o Chromium (WebView2) realmente
       usa como cor do glifo quando background-clip:text está ativo — sem ele, "color: transparent" sozinho
       não é suficiente em todo motor. */
    .tela-inicial .app-title.plano-ativo {
        background: linear-gradient(90deg, #15803d, #4ade80);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        -webkit-text-fill-color: transparent;
    }

    .tela-inicial .app-title.plano-inativo {
        background: linear-gradient(90deg, #7f1d1d, #ef4444);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        -webkit-text-fill-color: transparent;
    }

.app-subtitle {
    font-size: 10px;
    font-weight: bold;
    color: #9ca3af;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
}

.language-buttons {
    display: flex;
    gap: 10px;
}

.lang-btn {
    width: 45px;
    height: 35px;
    font-size: 14px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .lang-btn:hover {
        background: #282837;
    }

    .lang-btn.active {
        background: #4f46e5;
    }

/* ========== CONTENT AREA ========== */
.content-area {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: #12121c;
    border-right: 1px solid #23232d;
    /*padding: 15px 0;*/
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.menu-items {
    display: flex;
    flex-direction: column;
}

.menu-item {
    width: 100%;
    padding: 15px 25px;
    text-align: left;
    background: transparent;
    border: none;
    color: #aab;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    white-space: nowrap;
}

    .menu-item:hover {
        background: #232333;
        color: white;
    }

    .menu-item.active {
        background: #4f46e5;
        color: white;
        font-weight: bold;
    }

.menu-item-pai {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

    /* "Acessórios" é só um cabeçalho que abre/fecha o submenu — não uma tela em si — então não leva o
       preenchimento sólido que os outros itens do menu (que navegam direto pra uma tela) recebem quando
       ativos; só muda a cor do texto/ícone, igual um cabeçalho de seção comum. */
    .menu-item-pai.active {
        background: transparent;
        color: #a5b4fc;
        font-weight: bold;
    }

.submenu-chevron {
    font-size: 10px;
    opacity: 0.7;
    margin-left: auto;
}

.submenu {
    display: flex;
    flex-direction: column;
    margin: 2px 0 6px 20px;
    padding-left: 10px;
    border-left: 2px solid #23232d;
}

.submenu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 9px 12px;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #aab;
    font-size: 10.5px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.submenu-item i {
    width: 0.9rem;
    text-align: center;
    opacity: 0.85;
}

.submenu-item:hover {
    background: #232333;
    color: white;
}

.submenu-item.active {
    background: transparent;
    color: #a5b4fc;
    font-weight: bold;
}

.sidebar-spacer {
    flex: 1;
    min-height: 20px;
}

/* ========== QR CODE SECTION ========== */
.qr-code-section {
    background: #171721;
    border-top: 1px solid #282837;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.qr-instruction {
    font-size: 9px;
    font-weight: bold;
    color: #c8c8dc;
    text-align: center;
    margin-bottom: 10px;
}

.qr-divider {
    width: 100%;
    height: 1px;
    background: #4f46e5;
    margin: 5px 0;
}

.qr-title {
    font-size: 12px;
    font-weight: bold;
    color: #6366f1;
    margin: 10px 0;
}

.qr-label {
    font-size: 9px;
    color: #9ca3af;
    margin-bottom: 5px;
}

.qr-value {
    font-size: 18px;
    font-weight: bold;
    color: #22c55e;
    margin-bottom: 5px;
}

.qr-beneficiary {
    font-size: 8px;
    font-style: italic;
    color: #9ca3af;
    margin-bottom: 10px;
}

.qr-code-container {
    width: 140px;
    height: 140px;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    margin: 10px 0;
    transition: transform 0.3s;
    flex-shrink: 0;
}

    .qr-code-container:hover {
        transform: scale(1.05);
    }

    .qr-code-container img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

.qr-hint {
    font-size: 8px;
    color: #78788c;
    text-align: center;
    margin-top: 5px;
}

/* ========== SUPPORT SECTION ========== */
.support-section {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.support-btn {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mac-btn {
    background: #643a26;
}

    .mac-btn:hover {
        background: #7a4a30;
    }

.buy-btn {
    background: #ea580c;
}

    .buy-btn:hover {
        background: #f97316;
    }

.youtube-btn {
    background: #dc2626;
}

    .youtube-btn:hover {
        background: #ef4444;
    }

.whatsapp-btn {
    background: #22c55e;
}

    .whatsapp-btn:hover {
        background: #4ade80;
    }

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    background: #191923;
    padding: 15px;
    overflow-y: auto;
    min-width: 0;
}

/* ========== FOOTER ========== */
.app-footer {
    height: 60px;
    min-height: 60px;
    background: #14141e;
    border-top: 1px solid #282837;
    padding: 8px 15px;
    flex-shrink: 0;
}

.tools-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    height: 100%;
    align-items: center;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 9px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
    flex-shrink: 0;
}

    .tool-btn:hover {
        filter: brightness(1.2);
    }

.tool-icon {
    font-size: 12px;
}

.tool-name {
    font-size: 9px;
}

/* ========== LOADING OVERLAY ========== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 30, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #4f46e5;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-message {
    color: #e0e0e0;
    font-size: 1rem;
}

/* ========== BARRA DE PROGRESSO DA ATUALIZAÇÃO (botão "Buscar Atualização") ========== */
.update-progress-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9500;
    background: #14141e;
    border-top: 2px solid #4f46e5;
    padding: 0.6rem 1.5rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
}

.update-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.update-progress-msg {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.update-progress-count {
    flex-shrink: 0;
    margin-left: 1rem;
    color: #a5b4fc;
    font-weight: 600;
}

.update-progress-track {
    width: 100%;
    height: 8px;
    background: #2a2a3a;
    border-radius: 4px;
    overflow: hidden;
}

.update-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #4f46e5);
    transition: width 0.3s ease;
}

.update-ready-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9500;
    background: #14301e;
    border-top: 2px solid #22c55e;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    color: #e0e0e0;
    font-size: 0.9rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
}

.update-ready-acoes {
    display: flex;
    gap: 0.6rem;
}

.update-ready-btn {
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    color: #0a0a0a;
    background: #22c55e;
}

    .update-ready-btn.secundario {
        background: transparent;
        color: #e0e0e0;
        border: 1px solid #555;
    }

    .update-ready-btn:hover {
        filter: brightness(1.1);
    }

/* ========== TOAST (alerta popup centralizado, some sozinho) ========== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 18px 26px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    text-align: center;
    z-index: 10000;
    animation: toastPopIn 0.25s ease;
    max-width: 420px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.toast-content {
    white-space: pre-line;
}

    .toast.success {
        background: #22c55e;
    }

    .toast.error {
        background: #ef4444;
    }

    .toast.info {
        background: #3b82f6;
    }

    .toast.warning {
        background: #f59e0b;
    }

/* ========== Modal de confirmação do botão "Restaurar EDF Editor" ========== */
.restaurar-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.restaurar-confirm-modal {
    width: 100%;
    max-width: 460px;
    background: #1e1e2e;
    border: 1px solid #282837;
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    color: #e0e0e0;
}

    .restaurar-confirm-modal p {
        margin: 0 0 1rem;
        font-size: 0.9rem;
        line-height: 1.5;
    }

.restaurar-confirm-acoes {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
}

.restaurar-confirm-btn {
    border: 1px solid #555;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    color: #e0e0e0;
    background: transparent;
}

    .restaurar-confirm-btn.perigo {
        background: #ef4444;
        border-color: #ef4444;
        color: #fff;
    }

    .restaurar-confirm-btn:hover {
        filter: brightness(1.1);
    }

@keyframes toastPopIn {
    from {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ========== PÁGINA DE ERRO (Pages/Error.cshtml, só carrega app.css) ========== */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: #12121c;
}

.error-content {
    text-align: center;
    padding: 40px;
    background: #1e1e2e;
    border-radius: 12px;
    max-width: 500px;
}

.error-title {
    font-size: 3rem;
    color: #ef4444;
    margin: 0;
}

.error-subtitle {
    color: #e0e0e0;
    margin: 20px 0;
}

.error-request-id {
    color: #9ca3af;
    font-size: 0.9rem;
}

.error-actions {
    margin-top: 20px;
}

    .error-actions .btn-primary {
        display: inline-block;
        padding: 10px 24px;
        background: #4f46e5;
        color: white;
        text-decoration: none;
        border-radius: 6px;
        font-weight: bold;
        transition: background 0.3s;
    }

        .error-actions .btn-primary:hover {
            background: #6366f1;
        }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a24;
}

::-webkit-scrollbar-thumb {
    background: #3a3a4a;
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #4a4a5a;
    }

/* ========== RESPONSIVIDADE ========== */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
        min-width: 220px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
        min-width: 200px;
    }

    .center-container {
        width: 90vw;
        min-height: 250px;
    }

    .progress-bar-container {
        width: 90%;
    }

    .app-header {
        padding: 10px 15px;
        height: 65px;
        min-height: 65px;
    }

    .app-title {
        font-size: 16px;
    }

    .app-subtitle {
        font-size: 8px;
    }

    .menu-item {
        padding: 12px 15px;
        font-size: 10px;
    }

    .qr-code-container {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 180px;
        min-width: 180px;
    }

    .app-footer {
        height: 50px;
        min-height: 50px;
        padding: 5px 10px;
    }

    .tool-btn {
        padding: 8px 10px;
        font-size: 8px;
    }
}

/* Abaixo de 900px a sidebar deixa de disputar espaço com o conteúdo (que ficava espremido em
   telas estreitas) e vira uma gaveta sobreposta, aberta pelo botão de menu no cabeçalho. */
@media (max-width: 900px) {
    .menu-toggle-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        min-width: 260px;
        max-width: 80vw;
        height: 100vh;
        z-index: 1200;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.4);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

        .sidebar.sidebar-open {
            transform: translateX(0);
        }

    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1100;
    }
}

/* bolinha de conexão com o Google Sheets, ao lado do MAC */
.sheets-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}
.sheets-dot-verde { background: #22c55e; animation: sheets-pisca 1.2s ease-in-out infinite; }
.sheets-dot-amarelo { background: #facc15; }
.sheets-dot-vermelho { background: #ef4444; }
@keyframes sheets-pisca {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, .7); }
    50% { opacity: .35; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

