/* =====================================================
   RX PRULE - Light Theme (Config-driven)
   Developer: RonnyyApp
   Cores carregadas via config.json -> CSS vars
   ===================================================== */

/* === RESET === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #6d28d9;
    --primary-vivid: #8b5cf6;

    --bg-primary: #ffffff;
    --bg-secondary: #f8f7fc;
    --bg-card: #f3f0fa;
    --bg-header: rgba(255, 255, 255, 0.97);
    --bg-footer: #1e1b2e;

    --text-primary: #1a1a2e;
    --text-secondary: #4a4565;
    --text-muted: #8b83a8;

    --border-color: #e5e0f0;
    --border-light: #d4cde6;

    --glow: rgba(124, 58, 237, 0.10);
    --glow-strong: rgba(124, 58, 237, 0.18);
    --glow-border: rgba(124, 58, 237, 0.20);

    --font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.10);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

ul { list-style: none; }

/* =====================================================
   HEADER
   ===================================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    height: 64px;
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Logo */
.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.header-logo img {
    height: 34px;
    width: auto;
    object-fit: contain;
}

.header-logo .brand-name {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--primary);
}

/* Nav */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.header-nav a {
    position: relative;
    padding: 0.55rem 1.15rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.015em;
    transition: var(--transition);
    border-radius: 6px;
}

.header-nav a:hover {
    color: var(--primary);
    background: var(--glow);
}

.header-nav a.active {
    color: var(--primary);
    font-weight: 600;
}

.header-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 2.5px;
    background: var(--primary);
    border-radius: 2px;
}

/* Language */
.header-lang {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: var(--transition);
    flex-shrink: 0;
    position: relative;
}

.header-lang:hover {
    background: var(--glow);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.header-lang img.flag-icon {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
}

/* Language Dropdown */
.lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
}

.lang-dropdown.open {
    display: block;
    animation: fadeIn 0.2s ease;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.lang-option:hover {
    background: var(--glow);
    color: var(--text-primary);
}

.lang-option.active {
    color: var(--primary);
    background: var(--glow);
    font-weight: 600;
}

.lang-option img {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
}

/* Mobile Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--glow);
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* =====================================================
   MAIN
   ===================================================== */
.main {
    padding-top: 64px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    min-height: calc(100vh - 64px);
}

.container {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 3.5rem 1.5rem 4rem;
}

/* Title */
.page-title {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.page-subtitle {
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.6;
}

/* =====================================================
   TABS
   ===================================================== */
.tabs {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--bg-card, #f3f0fa);
    border-radius: 12px;
    padding: 0.25rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    letter-spacing: 0.015em;
    border-radius: 10px;
    font-family: var(--font-family);
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: #fff;
    font-weight: 700;
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.tab-btn.active::after {
    display: none;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* =====================================================
   FORM
   ===================================================== */
.form-group {
    margin-bottom: 0.85rem;
    position: relative;
}

.form-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.4rem;
}

.form-input {
    width: 100%;
    background: #fff;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
    font-family: var(--font-family);
    box-sizing: border-box;
}

.form-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.7;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Password Toggle */
.input-password-wrap {
    position: relative;
}

.input-password-wrap .form-input {
    padding-right: 2.5rem;
}

.toggle-password {
    position: absolute;
    right: 0.2rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.toggle-password:hover {
    color: var(--primary);
}

.toggle-password svg {
    width: 18px;
    height: 18px;
}

/* Checkbox */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
    user-select: none;
}

.form-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
    background: transparent;
}

.form-checkbox input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.form-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1.5px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.form-checkbox span {
    font-size: 0.86rem;
    color: var(--text-secondary);
}

/* Button */
.btn-submit {
    display: block;
    width: 100%;
    margin: 1rem auto 0;
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
}

.btn-submit:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.35);
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0) scale(0.98);
}

/* Info Card */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.info-card .icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    background: var(--glow);
    border: 1px solid var(--glow-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-card .icon svg {
    width: 26px;
    height: 26px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 1.8;
}

.info-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.info-card p {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Steps */
.steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
}

.step-text {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* =====================================================
   LOGIN ERROR
   ===================================================== */
.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.84rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* =====================================================
   DASHBOARD
   ===================================================== */
.dash-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.dash-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--glow);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-avatar svg {
    width: 28px;
    height: 28px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 1.8;
}

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

.dash-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.dash-badge-supremo {
    background: #fef3c7;
    color: #92400e;
}

.dash-badge-revenda {
    background: #ede9fe;
    color: #6d28d9;
}

.btn-logout {
    padding: 0.5rem 1.2rem;
    background: transparent;
    border: 1.5px solid #dc2626;
    color: #dc2626;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
    flex-shrink: 0;
}

.btn-logout:hover {
    background: #dc2626;
    color: #fff;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.dash-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.dash-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.dash-card-icon {
    margin-bottom: 0.75rem;
}

.dash-card-icon svg {
    width: 32px;
    height: 32px;
}

.dash-card-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.3rem;
}

.dash-card-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.dash-card-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .dash-grid {
        grid-template-columns: 1fr;
    }
    .dash-header {
        flex-wrap: wrap;
    }
    .btn-logout {
        width: 100%;
        text-align: center;
    }
}

/* =====================================================
   FOOTER (escuro sempre)
   ===================================================== */
.footer {
    background: var(--bg-footer);
    border-top: none;
    padding: 2.5rem 2rem 1.5rem;
    color: #d0c8e0;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-brand .brand-name {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #a78bfa;
}

.footer-brand p {
    font-size: 0.8rem;
    color: #9a8fba;
    line-height: 1.6;
    max-width: 300px;
}

.footer-section h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #b3a9d4;
    margin-bottom: 1rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.footer-links a {
    font-size: 0.82rem;
    color: #8b83a8;
    transition: var(--transition);
}

.footer-links a:hover {
    color: #a78bfa;
}

.footer-bottom {
    max-width: 1100px;
    margin: 2rem auto 0;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-copy {
    font-size: 0.74rem;
    color: #8b83a8;
}

.footer-social {
    display: flex;
    gap: 0.75rem;
}

.footer-social a {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.2);
    transition: var(--transition);
}

.footer-social a:hover {
    background: rgba(167, 139, 250, 0.25);
    transform: translateY(-2px);
}

.footer-social a svg {
    width: 14px;
    height: 14px;
    fill: #9a8fba;
    transition: var(--transition);
}

.footer-social a:hover svg {
    fill: #a78bfa;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .header {
        padding: 0 1rem;
    }

    .header-nav {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(16px);
        flex-direction: column;
        padding: 0.75rem;
        gap: 0;
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-md);
        transform: translateY(-120%);
        opacity: 0;
        transition: var(--transition);
        pointer-events: none;
    }

    .header-nav.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .header-nav a {
        padding: 0.8rem 1rem;
        width: 100%;
    }

    .header-nav a.active::after { display: none; }
    .header-nav a.active { background: var(--glow); }

    .menu-toggle { display: flex; }

    .header-lang span:not(.flag-icon):not(img) {
        display: none;
    }

    .container {
        padding: 2.5rem 1.25rem 3rem;
    }

    .page-title { font-size: 1.4rem; }

    .tab-btn {
        padding: 0.7rem 1.25rem;
        font-size: 0.84rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-bottom {
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .tab-btn {
        padding: 0.65rem 1rem;
        font-size: 0.8rem;
    }

    .header-logo img { height: 28px; }
    .header-logo .brand-name { font-size: 0.95rem; }
    .page-title { font-size: 1.25rem; }
    .btn-submit { width: 100%; }
    #edit-layout { grid-template-columns: 1fr !important; }
}

/* Legal Pages */
.legal-content {
    text-align: left;
    font-size: 0.88rem;
    line-height: 1.8;
    color: var(--text-secondary, #4a4565);
}
.legal-content h3 {
    color: var(--primary, #7c3aed);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}
.legal-content p {
    margin-bottom: 0.75rem;
}
.legal-content strong {
    color: var(--text-primary, #1a1a2e);
}
