/* ============================================
   ENTREGA FÁCIL - ESTILOS GLOBAIS
   ============================================ */

:root {
    --primary-color: #FF6B00;
    --secondary-color: #1F2937;
    --bg-color: #F5F7FA;
    --success-color: #16A34A;
    --warning-color: #F59E0B;
    --error-color: #DC2626;
    --white: #FFFFFF;
    --text-color: #333333;
    --border-radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

/* ============================================
   LOGIN / AUTENTICAÇÃO (CENTRALIZAÇÃO GARANTIDA)
   ============================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center; /* Força todos os elementos internos a ficarem centralizados */
    text-align: center;
}

.logo-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.logo-img {
    max-width: 150px;
    height: auto;
    margin: 0 auto 0.5rem auto; /* Centralização explícita da imagem */
    display: block;
}

.logo-header h1 {
    color: var(--primary-color);
    margin: 0.5rem 0;
    font-size: 1.8rem;
}

.logo-header p {
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-top: 0.5rem;
}

/* Abas Login/Cadastrar */
.login-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    color: #4b5563;
}

.tab-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(255, 107, 0, 0.2);
}

/* Formulários de autenticação */
.auth-form {
    animation: fadeIn 0.3s ease-in-out;
    width: 100%;
}

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

/* Informações de demonstração */
.demo-info {
    margin-top: 1.5rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 8px;
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
    width: 100%;
}

.demo-info strong {
    color: #374151;
}

/* ============================================
   ALERTAS
   ============================================ */

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    width: 100%;
    text-align: left;
}

.alert-error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* ============================================
   FORMULÁRIOS GERAIS
   ============================================ */

.form-group {
    margin-bottom: 1rem;
    text-align: left;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

/* ============================================
   BOTÕES
   ============================================ */

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: opacity 0.3s;
    text-align: center;
}

.btn:hover {
    opacity: 0.9;
}

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

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

.btn-block {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 1rem;
}

/* ============================================
   TOPBAR (MOBILE)
   ============================================ */

.topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--secondary-color);
    color: var(--white);
    padding: 0.85rem 1rem;
    position: sticky;
    top: 0;
    z-index: 120;
}

.topbar-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.menu-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--white);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============================================
   SIDEBAR / NAVEGAÇÃO
   ============================================ */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 110;
}

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

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: var(--secondary-color);
    color: var(--white);
    padding: 1.25rem;
    z-index: 130;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-company {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

@media (min-width: 768px) {
    .topbar { display: none; }
    .sidebar-overlay { display: none !important; }
    .sidebar { transform: none; }
    .content { margin-left: 260px; padding: 2rem; }
}

.content {
    padding: 1.25rem;
    max-width: 1200px;
}

.sidebar .logo {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.sidebar ul { list-style: none; }
.sidebar li { margin-bottom: 0.35rem; }

.sidebar a {
    display: block;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    transition: background 0.2s;
    font-size: 0.95rem;
}

.sidebar a:hover,
.sidebar a:focus-visible {
    background: rgba(255,255,255,0.12);
}

/* ============================================
   CARDS E ESTATÍSTICAS
   ============================================ */

.card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.stat-card.warning { border-left-color: var(--warning-color); }
.stat-card.info { border-left-color: #3B82F6; }
.stat-card.success { border-left-color: var(--success-color); }

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

/* ============================================
   KANBAN
   ============================================ */

.kanban-board {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding-bottom: 1rem;
}

.kanban-column {
    min-width: 280px;
    background: #E5E7EB;
    padding: 1rem;
    border-radius: var(--border-radius);
}

.kanban-column h4 {
    margin-bottom: 1rem;
    text-align: center;
}

.kanban-card {
    background: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.kanban-card .card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

/* ============================================
   RASTREAMENTO PÚBLICO
   ============================================ */

.tracking-page {
    background: var(--bg-color);
    padding: 1rem;
}

.tracking-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.company-header {
    text-align: center;
    margin-bottom: 2rem;
}

.company-logo {
    max-width: 150px;
    margin: 0 auto;
    display: block;
}

.order-info {
    text-align: center;
    margin-bottom: 2rem;
}

.timeline {
    position: relative;
    padding-left: 20px;
    margin: 2rem 0;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
    padding-left: 1.5rem;
    border-left: 2px solid #ddd;
}

.timeline-item.completed {
    border-left-color: var(--success-color);
}

.timeline-marker {
    position: absolute;
    left: -6px;
    top: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ddd;
}

.timeline-item.completed .timeline-marker {
    background: var(--success-color);
}

.timeline-content strong { display: block; }
.timeline-content small { color: #666; }

/* ============================================
   PAINEL DO ENTREGADOR
   ============================================ */

.delivery-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.delivery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.delivery-actions {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

/* ============================================
   TABELAS E BADGES
   ============================================ */

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f9fafb;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    color: white;
    font-size: 0.75rem;
    white-space: nowrap;
}

.badge-success { background: var(--success-color); }
.badge-info { background: #3B82F6; }
.badge-muted { background: #6B7280; }

/* ============================================
   CABEÇALHO DE PÁGINA / DASHBOARD
   ============================================ */

.dashboard-header {
    margin-bottom: 1.5rem;
}

.dashboard-header h2 {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.dashboard-header p {
    color: #6b7280;
}

.card-hint {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 1.5rem !important;
}

/* ============================================
   FORMULÁRIOS EM GRADE (telas de cadastro)
   ============================================ */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem 1.25rem;
    align-items: end;
}

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

.form-grid > button {
    grid-column: 1 / -1;
    justify-self: start;
}

/* ============================================
   ESTADOS DE FOCO (ACESSIBILIDADE)
   ============================================ */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

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

/* ============================================
   BOTÕES — ESTADOS EXTRAS
   ============================================ */

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

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

/* Área de toque confortável no celular (mínimo ~44px recomendado) */
@media (max-width: 480px) {
    .btn:not(.btn-sm) {
        min-height: 44px;
    }
}

/* ============================================
   PEQUENOS AJUSTES DE INTERAÇÃO
   ============================================ */

.stat-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.kanban-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.delivery-actions .btn {
    flex: 1 1 auto;
    text-align: center;
}

/* ============================================
   RESPONSIVIDADE MOBILE
   ============================================ */

@media (max-width: 480px) {
    .login-container {
        padding: 1.5rem;
    }
    
    .logo-img {
        max-width: 120px; /* Um pouco menor em telas muito pequenas */
    }
    
    .tab-btn {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
}