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

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: rgba(31, 41, 55, 0.7);
    --border-color: rgba(75, 85, 99, 0.4);
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --primary: #10b981;
    --primary-hover: #059669;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --font-sans: 'Inter', sans-serif;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Reduz a escala geral da interface (equivalente a navegar em ~90% de zoom),
   já que todo o layout usa rem para tamanhos/espaçamentos. */
html {
    font-size: 90%;
}

body {
    background-color: var(--bg-primary);
    background-image: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 45%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

/* Layout Geral com Sidebar */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    transition: var(--transition);
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.close-sidebar-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.sidebar-site-info {
    padding: 1rem 1.5rem;
    background: rgba(99, 102, 241, 0.05);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-site-info i {
    color: var(--primary);
    font-size: 1.1rem;
}

.sidebar-site-info div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-site-info small {
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-site-info strong {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-nav a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(79, 70, 229, 0.12));
    border-left: 3px solid var(--accent);
    padding-left: calc(1rem - 3px);
    color: white;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.12);
}

.btn-logout-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid var(--danger);
    color: var(--danger);
    width: 100%;
    padding: 0.55rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-logout-sidebar:hover {
    background: var(--danger);
    color: white;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
}

.sidebar-overlay.visible {
    display: block;
}

/* Main Content Wrapper */
.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

.mobile-header {
    display: none;
    height: 70px;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 99;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand span {
    color: var(--primary);
}

/* Layout container */
main {
    flex: 1;
    padding: 2.25rem 2.5rem;
    width: 100%;
    max-width: 100%;
    margin: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-accent {
    background-color: var(--accent);
    color: white;
}

.btn-accent:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn:active {
    transform: translateY(1px);
}

/* Cards & Layout */
.card {
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    background-color: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.form-control::placeholder {
    color: #4b5563;
}

/* Select dropdowns — forçar fundo escuro no dropdown nativo do navegador */
select.form-control {
    appearance: auto;
    -webkit-appearance: auto;
    background-color: rgba(17, 24, 39, 0.95);
    color: var(--text-primary);
}

select.form-control option {
    background-color: #1f2937;
    color: var(--text-primary);
    padding: 0.5rem;
}

select.form-control option:checked {
    background-color: var(--primary);
    color: #fff;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    text-align: left;
}

th, td {
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid rgba(75, 85, 99, 0.2);
    font-size: 0.9rem;
}

th {
    color: var(--text-secondary);
    font-weight: 600;
    background-color: rgba(0, 0, 0, 0.15);
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

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

.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-info { background: rgba(99, 102, 241, 0.2); color: #818cf8; }

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

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Login box layout */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-card {
    max-width: 440px;
    width: 100%;
    padding: 2.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h2 {
    font-size: 1.8rem;
    font-weight: 800;
}

.login-logo h2 span {
    color: var(--primary);
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-left-color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-left-color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Autocomplete suggestions dropdown styling */
.autocomplete-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: #1f2937;
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.autocomplete-suggestion {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    border-bottom: 1px solid rgba(75, 85, 99, 0.15);
}

.autocomplete-suggestion:hover {
    background: rgba(255,255,255,0.05);
    color: var(--primary);
}

/* Hamburger button — oculto no desktop */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 200;
    flex-direction: column;
    gap: 5px;
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

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

/* Nav user info — desktop */
.nav-user-info {
    margin-left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Mobile-first specific adjustments */
/* Media query para telas menores que 1200px (Mobile e Tablets) */
@media(max-width: 1200px) {
    .sidebar {
        left: -280px;
    }
    
    .sidebar.open {
        left: 0;
        box-shadow: 5px 0 25px rgba(0,0,0,0.6);
    }
    
    .close-sidebar-btn {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-header {
        display: flex;
    }

    main {
        padding: 1.25rem 1rem;
    }

    /* Hambúrguer visível no mobile */
    .hamburger-btn {
        display: flex;
    }

    /* Grid de cadastro empilhado no mobile */
    .admin-register-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-card {
        padding: 1.25rem;
    }
    th, td {
        padding: 0.75rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* Custom Alert Messages */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    border-width: 1px;
    border-style: solid;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
    color: #a7f3d0;
}

/* Forçar comportamento fluido em todos os containers internos para aproveitar 100% da tela ao lado da sidebar */
.container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Colapso de grids internos (formulários, filtros, painéis lado a lado) em telas de celular.
   Várias views definem grid-template-columns fixo (ex: 2fr 1fr, 1fr 1fr 1fr) via style inline,
   o que espreme os campos em telas estreitas. Esta classe força 1 coluna nesse breakpoint. */
@media (max-width: 768px) {
    .grid-collapse-sm {
        grid-template-columns: 1fr !important;
    }
}
