/* ========================================
   ENTREGADORES APP - ESTILOS PRINCIPAIS
   ======================================== */

/* Reset e Configurações Base */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f8fafc;
    color: #1e293b;
    overflow-x: hidden;
    min-height: 100vh;
}

/* PWA Específico */
@media screen and (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========================================
   LOADING SCREEN
   ======================================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.loading-content {
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
}

.loading-icon {
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

.loading-content h1 {
    margin: 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.loading-content p {
    margin: 1rem 0 0;
    opacity: 0.9;
}

/* ========================================
   SPINNER ANIMAÇÃO
   ======================================== */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */
.app-container {
    min-height: 100vh;
    animation: fadeIn 0.5s ease-out;
}

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   TELA DE LOGIN
   ======================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.6s ease-out;
}

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

.app-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

.login-header h1 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
}

.login-header p {
    margin: 0 0 1rem;
    color: #64748b;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: #f1f5f9;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-indicator.offline {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* ========================================
   FORMULÁRIOS
   ======================================== */
.login-form {
    space-y: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* ========================================
   BOTÕES
   ======================================== */
.btn-primary {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    color: #475569;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.btn-action.location {
    background: #c3e9fd;
    color: #374151;
}

.btn-action.location:hover {
    background: #079cff;
}

.btn-action.whatsapp {
    background: #dcfce7;
    color: #166534;
}

.btn-action.whatsapp:hover {
    background: #bbf7d0;
}

.btn-action.deliver {
    background: #3b82f6;
    color: white;
    width: 100%;
}

.btn-action.deliver:hover {
    background: #2563eb;
}

.btn-action.call {
    background-color: #2196F3; /* Azul para o botão de ligar */
    color: white;
    padding: 8px 16px;
    width: 100%;
}

.btn-action.call:hover {
    background: #2563eb;
}

/* ========================================
   MENSAGENS DE ERRO
   ======================================== */
.error-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    border-radius: 0.5rem;
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 1rem;
    animation: slideUp 0.3s ease-out;
}

/* ========================================
   DASHBOARD
   ======================================== */
.dashboard-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

.user-info h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.user-info p {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    color: #64748b;
}

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

.status-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.offline-count {
    background: #f59e0b;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
}

/* ========================================
   ESTATÍSTICAS
   ======================================== */
.stats-section {
    padding: 1rem;
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f5f9;
    animation: slideUp 0.4s ease-out;
}

.stat-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
}

.stat-card.pending .stat-icon {
    background: rgba(249, 115, 22, 0.1);
}

.stat-card.delivered .stat-icon {
    background: rgba(34, 197, 94, 0.1);
}

.stat-info p {
    margin: 0 0 0.25rem;
    font-size: 0.875rem;
    color: #64748b;
}

.stat-info h3 {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 600;
    color: #1e293b;
}

/* ========================================
   CONTEÚDO PRINCIPAL
   ======================================== */
.main-content {
    flex: 1;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 2rem;
}

/* ========================================
   SISTEMA DE ABAS
   ======================================== */
.tabs-container {
    margin-bottom: 1.5rem;
}

.tabs-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f1f5f9;
    border-radius: 0.75rem;
    padding: 0.25rem;
}

.tab-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: #64748b;
}

.tab-button.active {
    background: white;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-count {
    background: #e2e8f0;
    color: #475569;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
}

.tab-button.active .tab-count {
    background: #3b82f6;
    color: white;
}

/* ========================================
   CONTEÚDO DAS ABAS
   ======================================== */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

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

/* ========================================
   LISTA DE PEDIDOS
   ======================================== */
.pedidos-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pedido-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f5f9;
    animation: slideUp 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.pedido-card.pending {
    border-left: 4px solid #f59e0b;
    background: rgba(251, 191, 36, 0.02);
}

.pedido-card.delivered {
    border-left: 4px solid #10b981;
    background: rgba(16, 185, 129, 0.02);
}

/* Header do Pedido */
.pedido-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.pedido-info h3 {
    margin: 0 0 0.25rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.pedido-info p {
    margin: 0;
    color: #64748b;
    font-weight: 500;
}

.pedido-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.pedido-badge.pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.pedido-badge.delivered {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

/* Detalhes do Pedido */
.pedido-details {
    margin-bottom: 1.5rem;
}

.detail-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

.detail-icon {
    font-size: 1.125rem;
    width: 1.5rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.detail-content {
    flex: 1;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.detail-value {
    color: #1e293b;
    font-weight: 500;
    line-height: 1.4;
}

.detail-subtitle {
    color: #64748b;
    font-size: 0.875rem;
    margin-top: 0.125rem;
}

/* Ações do Pedido */
.pedido-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ========================================
   ESTADOS VAZIOS E LOADING
   ======================================== */
.content-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.content-loading .spinner {
    border-color: rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 0.5rem;
    color: #64748b;
    font-size: 1.125rem;
}

.empty-state p {
    margin: 0;
    color: #94a3b8;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 320px;
}

.toast {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(100%);
    animation: slideInRight 0.3s ease-out forwards;
    position: relative;
}

.toast.success {
    border-left: 4px solid #10b981; /* Verde para toasts de sucesso */
    background: rgba(16, 185, 129, 0.8); /* Fundo verde com opacidade aumentada */
}

.toast.error {
    border-left: 4px solid #ef4444; /* Vermelho para toasts de erro */
    background: rgba(239, 68, 68, 0.8); /* Fundo vermelho com opacidade aumentada */
}

.toast.warning {
    border-left: 4px solid #f59e0b; /* Amarelo para toasts de aviso */
    background: rgba(245, 158, 11, 0.8); /* Fundo amarelo com opacidade aumentada */
}

.toast.info {
    border-left: 4px solid #3b82f6; /* Azul para toasts de informação */
    background: rgba(59, 130, 246, 0.8); /* Fundo azul com opacidade aumentada */
}
.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-weight: 500;
    color: #1e293b;
}

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

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

/* ========================================
   RESPONSIVIDADE
   ======================================== */
@media (max-width: 768px) {
    .login-card {
        padding: 1.5rem;
        margin: 0.5rem;
    }

    .dashboard-header {
        padding: 0.75rem;
    }
    
      .app-icon {
        width: 32px;
        height: 32px;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .header-right {
        gap: 0.5rem;
    }

    .stats-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .main-content {
        padding: 0.75rem;
    }

    .pedido-card {
        padding: 1rem;
    }

    .actions-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }

    .tab-button {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 1rem;
    }

    .app-icon {
        width: 32px;
        height: 32px;
    }

    .login-header h1 {
        font-size: 1.25rem;
    }

    .header-left {
        gap: 0.5rem;
    }

    .avatar {
        width: 40px;
        height: 40px;
    }

    .user-info h2 {
        font-size: 1rem;
    }

    .stats-container {
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .stat-icon {
        font-size: 1.5rem;
        width: 48px;
        height: 48px;
    }

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

/* ========================================
   MELHORIAS DE ACESSIBILIDADE
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible para usuários de teclado */
button:focus-visible,
input:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Melhor contraste para texto */
@media (prefers-contrast: high) {
    .detail-subtitle,
    .user-info p,
    .stat-info p {
        color: #374151;
    }
}