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

:root {
    --bg-dark-0: #0a0c10;
    --bg-dark-1: #0f141d;
    --bg-dark-2: #161d2a;
    --bg-dark-3: #1e2838;
    --glass-bg: rgba(22, 29, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(0, 145, 255, 0.4);
    --accent-blue: #0084ff;
    --accent-glow: rgba(0, 132, 255, 0.35);
    --accent-cyan: #00e5ff;
    --accent-gradient: linear-gradient(135deg, #0084ff 0%, #00e5ff 100%);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --emerald-500: #10b981;
    --emerald-glow: rgba(16, 185, 129, 0.3);
    --rose-500: #f43f5e;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --font-primary: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-dark-0);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 20% 15%, rgba(0, 132, 255, 0.07) 0%, transparent 40%),
        radial-gradient(circle at 80% 85%, rgba(0, 229, 255, 0.05) 0%, transparent 45%);
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark-1); }
::-webkit-scrollbar-thumb { background: var(--bg-dark-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-blue); }

/* UTILITÁRIOS E CLASSES DE TRANSIÇÃO */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.35s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* BUTTONS & CONTROLS */
.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--accent-glow);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(0, 145, 255, 0.55);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
}

.btn-success {
    background: #059669;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--emerald-glow);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-success:hover { background: #10b981; transform: translateY(-2px); }

/* AUTH TICKET (LOGIN / SIGNUP VIEW) */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}
.auth-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--accent-gradient);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}
.auth-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: var(--bg-dark-2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 25px rgba(0, 132, 255, 0.2);
}
.auth-logo img { width: 36px; height: 36px; object-fit: contain; }
.auth-header h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px; }
.auth-header p { color: var(--text-secondary); font-size: 0.9rem; }
.domain-badge {
    background: rgba(0, 132, 255, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 229, 255, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 600;
    display: inline-block;
    margin-top: 8px;
}

.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-control {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-dark-1);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: all 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 132, 255, 0.25);
}
.form-control::placeholder { color: var(--text-muted); }

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 25px;
}
.auth-tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.auth-tab.active {
    color: #fff;
    border-bottom-color: var(--accent-blue);
}

/* NAVBAR */
.navbar {
    height: 70px;
    background: var(--bg-dark-1);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(15px);
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}
.nav-brand img { width: 38px; height: 38px; }
.nav-title h2 { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.5px; color: #fff; }
.nav-title h2 span { color: var(--accent-blue); font-weight: 300; }
.nav-title p { font-size: 0.75rem; color: var(--text-secondary); font-family: var(--font-mono); text-transform: uppercase; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 20px;
}
.user-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}
.user-badge i { color: var(--emerald-500); font-size: 0.7rem; }

/* MAIN LAYOUT */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 70px);
}
.sidebar {
    width: 250px;
    background: var(--bg-dark-1);
    border-right: 1px solid var(--glass-border);
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.nav-link {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    cursor: pointer;
}
.nav-link i { font-size: 1.1rem; width: 20px; text-align: center; color: var(--text-muted); transition: color 0.2s;}
.nav-link:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}
.nav-link.active {
    background: rgba(0, 132, 255, 0.12);
    color: var(--accent-cyan);
    font-weight: 600;
    border-left: 3px solid var(--accent-blue);
}
.nav-link.active i { color: var(--accent-cyan); }

.content-area {
    flex: 1;
    padding: 30px;
    max-width: calc(100vw - 250px);
}

/* GENERATOR SPLIT VIEW */
.generator-split {
    display: grid;
    grid-template-columns: 480px 1fr;
    gap: 30px;
    height: calc(100vh - 130px);
}
.gen-controls {
    background: var(--bg-dark-1);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}
.gen-preview-container {
    background: var(--bg-dark-1);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.preview-header {
    background: var(--bg-dark-2);
    padding: 14px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.preview-title {
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.preview-title i { color: var(--accent-cyan); }
.preview-actions { display: flex; gap: 10px; }

.preview-body {
    flex: 1;
    background: #52565e;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
#docIframe {
    width: 210mm;
    height: 297mm;
    border: none;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    transform-origin: top center;
}

/* TYPE SELECTOR CARDS */
.type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.type-card {
    background: var(--bg-dark-2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.type-card:hover { border-color: var(--glass-border-hover); }
.type-card.selected {
    background: rgba(0, 132, 255, 0.15);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 132, 255, 0.2);
}
.type-card i { font-size: 1.5rem; color: var(--accent-cyan); margin-bottom: 8px; display: block; }
.type-card h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 2px; }
.type-card p { font-size: 0.75rem; color: var(--text-secondary); }

/* HISTORIC & TABLE */
.history-view {
    background: var(--bg-dark-1);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 30px;
}
.table-responsive { width: 100%; overflow-x: auto; margin-top: 20px;}
.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.table th {
    padding: 14px 16px;
    background: var(--bg-dark-2);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 1px solid var(--glass-border);
}
.table td {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
}
.table tr:hover { background: rgba(255, 255, 255, 0.02); }
.badge-doc {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-doc.proposta { background: rgba(0, 132, 255, 0.15); color: #60a5fa; }

/* TOAST ALERTS */
.toast-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--bg-dark-2);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--accent-blue);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    animation: toastSlideIn 0.3s ease-out forwards;
}
@keyframes toastSlideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.error { border-left-color: var(--rose-500); }
.toast.success { border-left-color: var(--emerald-500); }

/* SPINNER */
.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease-in-out infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
