/* ========================================
   Bootstrap 5 + Tailwind CSS - Sistema de Ordens de Serviço
   ========================================
   CSS customizado otimizado para coexistência com Bootstrap 5 e Tailwind CSS
   Mantém apenas estilos essenciais e específicos do projeto
   ======================================== */

/* ===========================================
   1. VARIÁVEIS E TEMA
   =========================================== */
:root {
    /* Bootstrap base colors */
    --bs-body-bg: #ffffff;
    --bs-body-color: #212529;

    /* Espaçamentos customizados */
    --spacing-mobile-header: 60px;
    --spacing-desktop-header: 80px;
    --spacing-footer-mobile: 60px;

    /* Cores de ícones customizadas */
    --icon-primary: #0d6efd;
    --icon-success: #198754;
    --icon-info: #0dcaf0;
    --icon-warning: #ffc107;
    --icon-danger: #dc3545;
    --icon-secondary: #6c757d;
    --icon-purple: #6f42c1;
    --icon-orange: #fd7e14;
    --icon-teal: #20c997;
    --icon-pink: #d63384;
}

/* ===========================================
   2. UTILIDADES DE ÍCONES COLORIDOS
   =========================================== */
.icon-primary { color: var(--icon-primary) !important; }
.icon-success { color: var(--icon-success) !important; }
.icon-info { color: var(--icon-info) !important; }
.icon-warning { color: var(--icon-warning) !important; }
.icon-danger { color: var(--icon-danger) !important; }
.icon-secondary { color: var(--icon-secondary) !important; }
.icon-purple { color: var(--icon-purple) !important; }
.icon-orange { color: var(--icon-orange) !important; }
.icon-teal { color: var(--icon-teal) !important; }
.icon-pink { color: var(--icon-pink) !important; }

/* Bordas coloridas customizadas */
.border-purple { border-color: var(--icon-purple) !important; }
.border-orange { border-color: var(--icon-orange) !important; }
.border-teal { border-color: var(--icon-teal) !important; }

/* ===========================================
   3. COMPONENTES - CARDS
   =========================================== */
/* Cards com hover effect suave */
.service-card,
.ordem-card,
.solicitacao-card,
.tipo-servico-filter-card {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover,
.ordem-card:hover,
.solicitacao-card:hover,
.tipo-servico-filter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* ===========================================
   4. LAYOUT - MOBILE HEADER
   =========================================== */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid #dee2e6;
    z-index: 1020;
    padding-top: max(env(safe-area-inset-top), 0px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mobile-header h5 {
    font-size: 1rem;
    font-weight: 600;
}

.mobile-header .small {
    font-size: 0.75rem;
}

/* ===========================================
   5. LAYOUT - MAIN CONTENT
   =========================================== */
.main-content {
    padding-top: var(--spacing-desktop-header);
    padding-bottom: 20px;
    min-height: calc(100vh - var(--spacing-desktop-header));
}

@media (max-width: 767.98px) {
    .main-content {
        padding-top: var(--spacing-mobile-header);
        padding-bottom: calc(var(--spacing-footer-mobile) + 20px);
        min-height: calc(100vh - var(--spacing-mobile-header));
    }
}

/* ===========================================
   6. MOBILE FOOTER NAVIGATION
   =========================================== */
.mobile-footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1030;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Ocultar em desktop */
@media (min-width: 768px) {
    .mobile-footer-nav {
        display: none !important;
    }

    .mobile-header {
        display: none !important;
    }
}

/* Container do footer */
.mobile-footer-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 4px 0;
    max-width: 100%;
    height: 60px;
}

/* Itens do footer */
.mobile-footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex: 1;
    min-width: 0;
    border-radius: 8px;
    margin: 0 2px;
}

.mobile-footer-item:active {
    background-color: #f8f9fa;
    transform: scale(0.95);
}

.mobile-footer-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-footer-item.active {
    color: #0d6efd;
}

.mobile-footer-item.active i {
    transform: scale(1.1);
}

.mobile-footer-item span:not(.mobile-footer-badge) {
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-weight: 500;
    line-height: 1.2;
}

.mobile-footer-item:hover {
    color: #0d6efd;
    text-decoration: none;
}

/* Botão primário destacado (Nova Ordem) */
.mobile-footer-primary {
    color: #0d6efd;
    background-color: #e7f1ff;
    padding: 6px 10px;
}

.mobile-footer-primary i {
    font-size: 1.6rem;
    color: #0d6efd;
}

.mobile-footer-primary.active {
    background-color: #cfe2ff;
}

.mobile-footer-primary:active {
    background-color: #b6d4fe;
}

/* Badge de notificação */
.mobile-footer-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ===========================================
   7. MOBILE FOOTER - DROPDOWN MENU
   =========================================== */
.mobile-footer-menu {
    position: relative;
    cursor: pointer;
}

.mobile-footer-dropdown {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    margin-bottom: 8px;
    display: none;
    padding: 8px 0;
    z-index: 1040;
}

.mobile-footer-dropdown.show {
    display: block;
    animation: slideUpFade 0.2s ease-out;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.mobile-footer-dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #212529;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.mobile-footer-dropdown-item i {
    margin-right: 10px;
    font-size: 1rem;
    width: 20px;
}

.mobile-footer-dropdown-item:hover,
.mobile-footer-dropdown-item:active {
    background-color: #f8f9fa;
    color: #0d6efd;
    text-decoration: none;
}

.mobile-footer-divider {
    margin: 8px 0;
    border-top: 1px solid #dee2e6;
}

/* ===========================================
   8. AJUSTES RESPONSIVOS MOBILE
   =========================================== */
@media (max-width: 767.98px) {
    /* Typography mobile */
    h1, .h1 {
        font-size: 1.75rem;
    }

    h2, .h2 {
        font-size: 1.5rem;
    }

    /* Cards em mobile */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem !important;
    }

    /* Container mobile */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Botões em mobile */
    .btn-group-vertical {
        width: 100%;
    }
}

/* Telas muito pequenas (< 360px) */
@media (max-width: 360px) {
    .mobile-footer-item {
        padding: 4px 6px;
    }

    .mobile-footer-item i {
        font-size: 1.2rem;
    }

    .mobile-footer-item span:not(.mobile-footer-badge) {
        font-size: 0.6rem;
    }

    .mobile-footer-primary i {
        font-size: 1.4rem;
    }

    .mobile-footer-container {
        height: 55px;
        padding: 6px 0 2px 0;
    }
}

/* ===========================================
   9. PWA - MODO STANDALONE
   =========================================== */
@media (display-mode: standalone) {
    .mobile-header {
        padding-top: max(env(safe-area-inset-top), 8px);
    }

    .mobile-footer-nav {
        padding-bottom: max(env(safe-area-inset-bottom), 0px);
    }

    .main-content {
        padding-top: calc(60px + env(safe-area-inset-top));
    }
}

/* PWA Safe Area Support */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* ===========================================
   10. OFFLINE INDICATOR
   =========================================== */
.offline-indicator {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: #ffc107;
    color: #000;
    padding: 0.5rem;
    text-align: center;
    z-index: 1040;
    display: none;
    animation: slideDown 0.3s ease-out;
}

.offline .offline-indicator {
    display: block;
}

/* ===========================================
   11. ACESSIBILIDADE
   =========================================== */
/* Focus states melhorados */
.btn:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: none;
}

/* Links acessíveis */
a:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* ===========================================
   12. NAVBAR E FOOTER DESKTOP
   =========================================== */
.navbar.fixed-top {
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

footer.border-top {
    border-top: 1px solid #dee2e6 !important;
}

/* ===========================================
   13. UTILIDADES DE PERFORMANCE
   =========================================== */
/* Otimização de animações */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Hardware acceleration para animações */
.service-card,
.ordem-card,
.solicitacao-card,
.mobile-footer-item {
    will-change: transform;
    backface-visibility: hidden;
}
