/* ==========================================================================
   DEL VIDAL - PAINEL ADMINISTRATIVO (admin.css)
   Clean, Modern & Intuitive Dashboard Interface
   ========================================================================== */

:root {
    --admin-primary: #0B2545;
    --admin-sidebar: #061528;
    --admin-accent: #1D4ED8;
    --admin-gold: #C9A227;
    --admin-green: #10B981;
    --admin-danger: #EF4444;
    --admin-warning: #F59E0B;
    
    --admin-bg: #F1F5F9;
    --admin-card: #FFFFFF;
    --admin-border: #E2E8F0;
    
    --admin-text: #0F172A;
    --admin-text-muted: #64748B;
    --admin-text-light: #94A3B8;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-dropdown: 0 10px 25px -5px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background-color: var(--admin-sidebar);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header img {
    height: 32px;
    filter: brightness(0) invert(1);
}

.sidebar-header h2 {
    font-size: 1.05rem;
    color: #FFFFFF;
    font-weight: 700;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0.75rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-item-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--admin-text-light);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.nav-item-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #FFFFFF;
}

.nav-item-btn.active {
    background: var(--admin-accent);
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.35);
}

.nav-item-btn .badge {
    margin-left: auto;
    background: var(--admin-gold);
    color: #061528;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-view-site {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.65rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-view-site:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Main Content Area */
.admin-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}

/* Top Header */
.admin-top-header {
    background: #FFFFFF;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.admin-top-header h1 {
    font-size: 1.45rem;
    color: var(--admin-primary);
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.save-status {
    font-size: 0.85rem;
    color: var(--admin-green);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Content Container */
.admin-content {
    padding: 2rem;
    flex-grow: 1;
}

/* Dashboard Stats Overview */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--admin-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--admin-border);
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(29, 78, 216, 0.1);
    color: var(--admin-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--admin-green);
}

.stat-icon.gold {
    background: rgba(201, 162, 39, 0.1);
    color: var(--admin-gold);
}

.stat-info h4 {
    font-size: 0.85rem;
    color: var(--admin-text-muted);
    margin-bottom: 0.25rem;
}

.stat-info .stat-number {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--admin-primary);
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

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

/* Cards & Sections */
.admin-card {
    background: var(--admin-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--admin-border);
    box-shadow: var(--shadow-card);
    padding: 2rem;
    margin-bottom: 2rem;
}

.admin-card-header {
    border-bottom: 1px solid var(--admin-border);
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-card-header h3 {
    font-size: 1.2rem;
    color: var(--admin-primary);
}

.admin-card-header p {
    font-size: 0.875rem;
    color: var(--admin-text-muted);
}

/* Form Controls */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--admin-text);
    margin-bottom: 0.4rem;
}

.form-group .help-text {
    font-size: 0.775rem;
    color: var(--admin-text-muted);
    margin-top: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.925rem;
    font-family: inherit;
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-sm);
    background: #FFFFFF;
    color: var(--admin-text);
    transition: border 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--admin-accent);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-success {
    background: var(--admin-green);
    color: #FFFFFF;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--admin-danger);
    color: #FFFFFF;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: #E2E8F0;
    color: var(--admin-text);
}

.btn-secondary:hover {
    background: #CBD5E1;
}

/* Image Preview */
.image-preview-box {
    margin-top: 0.75rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    max-width: 320px;
    height: 180px;
    border: 2px dashed var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-bg);
}

.image-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Table CRM */
.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table th {
    background: var(--admin-bg);
    color: var(--admin-text-muted);
    font-weight: 600;
    text-align: left;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--admin-border);
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: #F8FAFC;
}

/* Badges */
.badge-status {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 9999px;
}

.badge-status.novo {
    background: rgba(16, 185, 129, 0.15);
    color: #065F46;
}

.badge-status.analise {
    background: rgba(245, 158, 11, 0.15);
    color: #92400E;
}

.badge-status.respondido {
    background: rgba(100, 116, 139, 0.15);
    color: #334155;
}

.badge-type {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: rgba(29, 78, 216, 0.1);
    color: var(--admin-accent);
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--admin-primary);
    color: #FFFFFF;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: #FFFFFF;
    width: 600px;
    max-width: calc(100vw - 32px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dropdown);
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--admin-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Responsive */
@media (max-width: 992px) {
    body {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .nav-item-btn {
        width: auto;
    }
}

/* ==========================================================================
   TELA DE LOGIN E SEGURANÇA (AUTH GATE OVERLAY)
   ========================================================================== */

.auth-gate-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #0B2545 0%, #061528 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-gate-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-login-card {
    background: rgba(255, 255, 255, 0.98);
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 2.5rem;
    text-align: center;
    animation: authCardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand-logo {
    background: #061528;
    padding: 1rem;
    border-radius: var(--radius-md);
    display: inline-block;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 20px rgba(6, 21, 40, 0.25);
}

.auth-brand-logo img {
    height: 48px;
    width: auto;
    object-fit: contain;
    display: block;
}

.auth-login-card h2 {
    font-size: 1.4rem;
    color: var(--admin-primary);
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.auth-login-card p {
    font-size: 0.875rem;
    color: var(--admin-text-muted);
    margin-bottom: 1.75rem;
}

.auth-input-group {
    text-align: left;
    margin-bottom: 1.25rem;
    position: relative;
}

.auth-input-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--admin-primary);
    margin-bottom: 0.35rem;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.75rem;
    border: 1.5px solid var(--admin-border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
    background: #F8FAFC;
}

.auth-input-wrapper input:focus {
    border-color: var(--admin-accent);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--admin-text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
}

.auth-error-alert {
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    color: #991B1B;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    display: none;
    text-align: left;
}

.auth-error-alert.show {
    display: block;
    animation: shakeError 0.35s ease;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.btn-auth-submit {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, #0B2545 0%, #1D4ED8 100%);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(29, 78, 216, 0.3);
}

.btn-auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.45);
}

.auth-security-badge {
    margin-top: 1.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--admin-text-muted);
    background: #F1F5F9;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
}
