@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
    --duo-green: #58cc02;
    --duo-green-dark: #46a302;
    --duo-green-light: #d7ffb8;
    --duo-blue: #1cb0f6;
    --duo-blue-dark: #1899d6;
    --duo-purple: #ce82ff;
    --duo-purple-dark: #a855f7;
    --duo-yellow: #ffc800;
    --duo-yellow-dark: #e5a500;
    --duo-orange: #ff9600;
    --duo-red: #ff4b4b;
    --duo-red-dark: #ea2b2b;
    --duo-gray-bg: #f7f9fa;
    --duo-card-bg: #ffffff;
    --duo-border: #e5e5e5;
    --duo-text-dark: #3c3c3c;
    --duo-text-muted: #777777;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-pill: 999px;
}

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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--duo-gray-bg);
    color: var(--duo-text-dark);
    line-height: 1.4;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

.mobile-wrapper {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0,0,0,0.06);
    position: relative;
}

@media (max-width: 600px) {
    body {
        background-color: #ffffff;
    }
    .mobile-wrapper {
        max-width: 100% !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
    }
}

/* Header Estilo Duolingo */
.app-header {
    background: #ffffff;
    padding: 14px 20px;
    border-bottom: 2px solid var(--duo-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--duo-green-dark);
}

.brand-badge .icon-logo {
    font-size: 1.4rem;
}

.user-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f3f5;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    font-size: 0.85rem;
    color: #495057;
    border: 2px solid #e9ecef;
}

.btn-sair {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--duo-red);
    margin-left: 6px;
}

/* Barra de Progresso Gamificada */
.progress-card {
    background: #ffffff;
    border: 2px solid var(--duo-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-top: 4px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.progress-meta {
    color: var(--duo-text-muted);
}

.progress-score {
    color: var(--duo-green-dark);
    font-size: 1.05rem;
}

.bar-container {
    width: 100%;
    height: 16px;
    background: #e5e5e5;
    border-radius: var(--radius-pill);
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #58cc02, #23d160);
    border-radius: var(--radius-pill);
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 0 var(--duo-green-dark) inset;
}

/* Conteúdo Principal */
.app-content {
    flex: 1;
    padding: 18px 20px 100px;
}

/* Telas / Seções */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tela de Identificação / Login */
.welcome-hero {
    text-align: center;
    padding: 30px 10px 20px;
}

.welcome-avatar {
    width: 90px;
    height: 90px;
    margin: 0 auto 16px;
    background: #f0fff0;
    border: 4px solid var(--duo-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-shadow: 0 8px 0 var(--duo-green-dark);
}

.welcome-hero h1 {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--duo-text-dark);
    margin-bottom: 8px;
}

.welcome-hero p {
    font-size: 0.95rem;
    color: var(--duo-text-muted);
    font-weight: 700;
}

/* Botões Estilo 3D Duolingo */
.btn-duo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    position: relative;
    transition: all 0.1s ease;
    user-select: none;
}

.btn-duo-green {
    background-color: var(--duo-green);
    color: #ffffff;
    box-shadow: 0 5px 0 var(--duo-green-dark);
}

.btn-duo-green:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--duo-green-dark);
}

.btn-duo-blue {
    background-color: var(--duo-blue);
    color: #ffffff;
    box-shadow: 0 5px 0 var(--duo-blue-dark);
}

.btn-duo-blue:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--duo-blue-dark);
}

.btn-duo-yellow {
    background-color: var(--duo-yellow);
    color: #493100;
    box-shadow: 0 5px 0 var(--duo-yellow-dark);
}

.btn-duo-yellow:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--duo-yellow-dark);
}

.btn-duo-secondary {
    background-color: #ffffff;
    color: #495057;
    border: 2px solid var(--duo-border);
    box-shadow: 0 4px 0 #d1d5db;
}

.btn-duo-secondary:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #d1d5db;
}

/* Formulários Ultra Simples */
.duo-form-card {
    background: #ffffff;
    border: 2px solid var(--duo-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 4px 0 var(--duo-border);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--duo-text-dark);
    margin-bottom: 6px;
}

.duo-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1.05rem;
    font-family: inherit;
    font-weight: 700;
    background: #f7f9fa;
    border: 2px solid #e5e5e5;
    border-radius: var(--radius-md);
    color: var(--duo-text-dark);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.duo-input:focus {
    border-color: var(--duo-blue);
    background: #ffffff;
}

/* Switch / Alternador de Sub-líder */
.switch-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fdf8e6;
    border: 2px solid #fed766;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 18px;
    cursor: pointer;
}

.switch-box-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch-box-info .star-icon {
    font-size: 1.3rem;
}

.switch-box-info h4 {
    font-size: 0.95rem;
    font-weight: 800;
    color: #5c4400;
}

.switch-box-info p {
    font-size: 0.78rem;
    color: #8c6800;
    font-weight: 700;
}

.duo-toggle {
    position: relative;
    width: 50px;
    height: 28px;
    appearance: none;
    background: #d1d5db;
    border-radius: 999px;
    cursor: pointer;
    outline: none;
    transition: background 0.2s;
}

.duo-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 4px;
    width: 22px;
    height: 22px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.duo-toggle:checked {
    background: var(--duo-yellow);
}

.duo-toggle:checked::after {
    transform: translateX(21px);
}

/* Seleção de Sub-líder Vinculado */
.select-sublider-box {
    margin-bottom: 18px;
}

/* Lista da Equipe */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-title h3 {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--duo-text-dark);
}

.badge-count {
    background: var(--duo-green-light);
    color: var(--duo-green-dark);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 900;
}

/* Cards da Lista */
.person-card {
    background: #ffffff;
    border: 2px solid var(--duo-border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.15s, box-shadow 0.15s;
}

.person-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 #e5e5e5;
}

.person-info {
    min-width: 0;
    flex: 1;
}

.person-info h4 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--duo-text-dark);
    word-break: break-word;
}

.person-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 0.8rem;
    color: var(--duo-text-muted);
    font-weight: 700;
    margin-top: 2px;
}

.badge-sub {
    background: #fff3bf;
    color: #a67300;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 900;
    white-space: nowrap;
}

.actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 8px;
}

.btn-action-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-action-icon:active {
    transform: scale(0.92);
}

.btn-whatsapp {
    background: #25d366;
    color: #ffffff;
    box-shadow: 0 3px 0 #1da851;
}

.btn-edit {
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
}

.btn-edit:active {
    background: #bae6fd;
}

/* Edição Inline dentro do Card (Sanfona Rápida) */
.inline-edit-box {
    display: none;
    width: 100%;
    box-sizing: border-box;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 2px dashed #e2e8f0;
    animation: fadeIn 0.2s ease;
}

.person-card.is-editing {
    background: #fcfdfe;
    border-color: var(--duo-blue);
    box-shadow: 0 6px 0 #bae6fd;
    display: flex;
    flex-direction: column;
}

.person-card.is-editing .inline-edit-box {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.inline-form-row {
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
}

.inline-form-row label {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    color: #475569;
    margin-bottom: 4px;
}

.inline-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 700;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    color: var(--duo-text-dark);
    outline: none;
}

.inline-input:focus {
    border-color: var(--duo-blue);
}

.btn-promover-inline {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    background: #fef3c7;
    border: 2px solid #fde047;
    border-radius: 12px;
    color: #854d0e;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s;
}

.btn-promover-inline:active {
    background: #fde047;
}

.inline-actions {
    display: flex;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.btn-inline-save {
    flex: 2;
    padding: 10px;
    background: var(--duo-green);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 3px 0 var(--duo-green-dark);
    cursor: pointer;
}

.btn-inline-save:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--duo-green-dark);
}

.btn-inline-cancel {
    flex: 1;
    padding: 10px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
}

/* Modal Mobile Estilo Duolingo & Modal Overlay Geral */
.duo-modal-overlay,
.modal-overlay {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999 !important;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.duo-modal-overlay.active,
.modal-overlay.active {
    display: flex !important;
}

.modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    position: relative;
    z-index: 100000;
}

.duo-modal-sheet {
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 24px 20px 32px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.duo-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.duo-modal-header h3 {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--duo-text-dark);
}

.duo-modal-close {
    background: #f1f3f5;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 900;
    cursor: pointer;
    color: #6c757d;
}

/* Tabs Mobile */
.tabs-container {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background: #f1f3f5;
    padding: 4px;
    border-radius: var(--radius-md);
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #ffffff;
    color: var(--duo-text-dark);
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}

/* Toast de Alerta Flutuante */
.toast-notice {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1f2937;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 999;
}

.toast-notice.show {
    transform: translateX(-50%) translateY(0);
}

/* Canvas de Confetes */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}
