/* ==========================================================================
   Dashboard Leilões – Estilos
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ==========================================================================
   Navbar
   ========================================================================== */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
}

.navbar-brand a {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    flex: 1;
    overflow-x: auto;
}

.navbar-menu li a {
    display: block;
    padding: 0.75rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
}

.navbar-menu li a:hover,
.navbar-menu li a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.navbar-user {
    position: relative;
    cursor: pointer;
    white-space: nowrap;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    background: var(--bg);
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 160px;
    z-index: 200;
}

.navbar-user:hover .user-dropdown { display: block; }

.user-dropdown a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
}

.user-dropdown a:hover { background: var(--bg); }
.user-dropdown .logout-link { color: var(--danger); }

/* ==========================================================================
   Container
   ========================================================================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ==========================================================================
   Flash messages
   ========================================================================== */
.flash-messages { margin-bottom: 1rem; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

.alert-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

/* ==========================================================================
   Page header
   ========================================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.header-actions { display: flex; gap: 0.5rem; }

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

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-card-warning { border-left-color: var(--warning); }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card-warning .stat-number { color: var(--warning); }
.stat-label { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.stat-card a { font-size: 0.8rem; color: var(--primary); text-decoration: none; }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
.card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.card-header h2 { margin-bottom: 0; }

.dashboard-grid, .detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .detail-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table thead th {
    background: var(--bg);
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

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

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr.row-inactive { opacity: 0.5; }
.table a { color: var(--primary); text-decoration: none; }
.table a:hover { text-decoration: underline; }

.valor { font-family: 'Courier New', monospace; font-weight: 600; white-space: nowrap; }
.texto-danger { color: var(--danger); }

.actions {
    display: flex;
    gap: 0.4rem;
    white-space: nowrap;
}

.inline-form { display: inline; }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-agendado { background: #dbeafe; color: #1e40af; }
.badge-em-andamento { background: #fef9c3; color: #854d0e; }
.badge-finalizado { background: #f3f4f6; color: #4b5563; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-auto { background: #e0f2fe; color: #075985; }
.badge-manual { background: #f3f4f6; color: #4b5563; }
.badge-admin { background: #fae8ff; color: #86198f; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    gap: 0.4rem;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #475569; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-block { width: 100%; margin-top: 0.75rem; }

/* ==========================================================================
   Forms
   ========================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 0.3rem; }

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text);
    background: var(--card-bg);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-section {
    font-size: 1rem;
    color: var(--primary);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

.form-check label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.form-inline-action {
    display: flex;
    gap: 0.5rem;
    align-items: end;
    margin-top: 0.75rem;
}

.form-inline-action input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    flex: 1;
}

/* ==========================================================================
   Filtros
   ========================================================================== */
.filtros-card { margin-bottom: 1rem; }
.filtros-card h3 { font-size: 0.9rem; margin-bottom: 0.75rem; }

.filtros-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}

.filtro-group { display: flex; flex-direction: column; gap: 0.25rem; }

.filtro-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.filtro-group input,
.filtro-group select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
}

.filtro-actions { display: flex; gap: 0.4rem; align-items: center; }

/* ==========================================================================
   Detail list (dl/dt/dd)
   ========================================================================== */
.detail-list { font-size: 0.875rem; }

.detail-list dt {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.6rem;
}

.detail-list dd {
    margin-left: 0;
    margin-bottom: 0.25rem;
}

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.empty-state .btn { margin-top: 0.75rem; }

/* ==========================================================================
   Upload
   ========================================================================== */
.upload-form { margin-top: 1rem; }

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-filename {
    display: block;
    margin-top: 0.5rem;
    font-weight: 600;
    color: var(--primary);
}

/* ==========================================================================
   Auth pages
   ========================================================================== */
.auth-body {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container { width: 100%; max-width: 420px; padding: 1rem; }

.auth-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.auth-card h1 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.auth-card h2 {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.auth-card .form-group { margin-bottom: 1rem; }

.auth-card .form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.auth-card .form-group input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.auth-card .form-group input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-link a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ==========================================================================
   Notificações
   ========================================================================== */
#notificacoes-container {
    position: fixed;
    top: 64px;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
}

.notificacao {
    background: var(--card-bg);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
}

.notificacao-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.notificacao-body { font-size: 0.8rem; color: var(--text-muted); }

.notificacao .alert-close {
    font-size: 1rem;
    padding: 0;
    margin-left: 0.5rem;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   Misc
   ========================================================================== */
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

code {
    background: var(--bg);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 0.5rem 1rem;
    }
    .navbar-menu { overflow-x: auto; }
    .container { padding: 1rem; }
    .filtros-form { flex-direction: column; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .table { font-size: 0.8rem; }
    .table thead th, .table tbody td { padding: 0.4rem; }
    .stats-grid { grid-template-columns: 1fr; }
}
