/* =========================================================
   BIKEOS MOBILE — FOLHA DE ESTILOS DEDICADA & BLINDADA
   Otimizado para iOS Safari e Android Chrome (ciclorei.com)
   ========================================================= */

:root {
    --bg-main: #060911;
    --bg-surface: #0e1626;
    --bg-card: #131c31;
    --bg-input: #1a2640;
    --border-subtle: #233354;
    --border-highlight: #3b507a;
    
    --color-orange: #f26522;
    --color-orange-glow: rgba(242, 101, 34, 0.35);
    --color-emerald: #10b981;
    --color-blue: #3b82f6;
    --color-amber: #f59e0b;
    --color-purple: #8b5cf6;
    --color-red: #ef4444;

    --text-white: #ffffff;
    --text-slate: #cbd5e1;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* REGRA CRÍTICA DE VISIBILIDADE */
.hidden, [hidden], div.hidden, section.hidden, .mobile-fullscreen-modal.hidden {
    display: none !important;
}

html, body {
    height: 100%;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    background-color: var(--bg-main);
    color: var(--text-slate);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

#app-container {
    height: 100dvh;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* =========================================================
   TOP HEADER
   ========================================================= */
.mobile-header {
    flex-shrink: 0;
    background: rgba(6, 9, 17, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding-top: max(12px, calc(var(--safe-top) + 8px));
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 40;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(242, 101, 34, 0.2);
    color: var(--color-orange);
    border: 1px solid rgba(242, 101, 34, 0.35);
    margin-left: 6px;
}

/* Botão Voltar Topo */
.btn-back-header {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-white);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.15s;
}

.btn-back-header:active {
    transform: scale(0.96);
    background: var(--border-subtle);
}

/* =========================================================
   MAIN SCROLL AREA
   ========================================================= */
.main-content-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 16px 16px 140px; /* Folga generosa para não ser tampado */
}

/* Custom scrollbar */
.main-content-scroll::-webkit-scrollbar {
    width: 3px;
}
.main-content-scroll::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

/* =========================================================
   TELA INICIAL / HUB DE ACESSO RÁPIDO (MENU PARA FUNCIONÁRIOS)
   ========================================================= */
.hub-welcome-banner {
    background: linear-gradient(135deg, #0e1626, #162035);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 18px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.hub-welcome-title {
    font-size: 18px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.hub-welcome-sub {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 2px;
}

.hub-section-label {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hub-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

/* Card de Acesso Rápido */
.hub-action-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    position: relative;
    overflow: hidden;
}

.hub-action-card:active {
    transform: scale(0.98);
}

.hub-action-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.hub-action-info {
    flex: 1;
    min-width: 0;
}

.hub-action-title {
    font-size: 16px;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 2px;
}

.hub-action-desc {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.3;
}

.hub-action-arrow {
    color: var(--text-dim);
    font-size: 20px;
    font-weight: 900;
    flex-shrink: 0;
}

/* Variantes de Cores para o Hub */
.card-orange {
    border-color: rgba(242, 101, 34, 0.4);
    background: linear-gradient(135deg, rgba(242, 101, 34, 0.08), rgba(14, 22, 38, 0.95));
}
.card-orange .hub-action-icon {
    background: linear-gradient(135deg, #f26522, #ea580c);
    box-shadow: 0 4px 16px rgba(242, 101, 34, 0.4);
}
.card-orange:active {
    border-color: var(--color-orange);
    box-shadow: 0 0 20px var(--color-orange-glow);
}

.card-amber {
    border-color: rgba(245, 158, 11, 0.4);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(14, 22, 38, 0.95));
}
.card-amber .hub-action-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.card-emerald {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(14, 22, 38, 0.95));
}
.card-emerald .hub-action-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.card-blue {
    border-color: rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(14, 22, 38, 0.95));
}
.card-blue .hub-action-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.card-purple {
    border-color: rgba(139, 92, 246, 0.4);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(14, 22, 38, 0.95));
}
.card-purple .hub-action-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.card-slate {
    border-color: rgba(148, 163, 184, 0.4);
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.08), rgba(14, 22, 38, 0.95));
}
.card-slate .hub-action-icon {
    background: linear-gradient(135deg, #475569, #334155);
    box-shadow: 0 4px 16px rgba(71, 85, 105, 0.4);
}

/* =========================================================
   SEARCH & FILTERS
   ========================================================= */
.search-action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input-wrapper input {
    width: 100%;
    height: 44px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 0 14px 0 38px;
    color: var(--text-white);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.search-input-wrapper input:focus {
    border-color: var(--color-orange);
    box-shadow: 0 0 0 3px var(--color-orange-glow);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.btn-new-action {
    height: 44px;
    padding: 0 14px;
    background: linear-gradient(135deg, var(--color-orange), #d15014);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-weight: 800;
    font-size: 13px;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(242, 101, 34, 0.35);
    cursor: pointer;
    transition: transform 0.15s;
    flex-shrink: 0;
}

.btn-new-action:active {
    transform: scale(0.96);
}

.filter-pills-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.filter-pills-bar::-webkit-scrollbar {
    display: none;
}

.pill-btn {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.15s;
}

.pill-btn.active {
    background: var(--color-orange);
    color: #ffffff;
    border-color: var(--color-orange);
    box-shadow: 0 2px 10px rgba(242, 101, 34, 0.3);
}

/* =========================================================
   CARDS DE ORDEM DE SERVIÇO & ORÇAMENTOS
   ========================================================= */
.os-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: border-color 0.2s, transform 0.15s;
}

.os-card:active {
    border-color: var(--border-highlight);
    transform: scale(0.99);
}

.os-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.os-badge-id {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 13px;
    color: var(--color-orange);
}

.os-badge-status {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    border: 1px solid transparent;
}

.status-emerald {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-emerald);
    border-color: rgba(16, 185, 129, 0.3);
}
.status-blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-blue);
    border-color: rgba(59, 130, 246, 0.3);
}
.status-orange {
    background: rgba(242, 101, 34, 0.15);
    color: var(--color-orange);
    border-color: rgba(242, 101, 34, 0.3);
}
.status-amber {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-amber);
    border-color: rgba(245, 158, 11, 0.3);
}
.status-slate {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-slate);
    border-color: rgba(148, 163, 184, 0.3);
}

.os-card-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 2px;
}

.os-card-bike {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.os-card-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-card-wa {
    height: 38px;
    padding: 0 12px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 10px;
    color: var(--color-emerald);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.btn-card-detail {
    height: 38px;
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-white);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
}

/* =========================================================
   FRENTE DE CAIXA (PDV MOBILE FULLSCREEN DEDICADO)
   ========================================================= */
.view-pdv-fullscreen {
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-main);
    position: relative;
    padding: 0;
    margin: 0;
}

.pdv-iframe {
    width: 100%;
    height: 100%;
    flex: 1;
    border: none;
    background: var(--bg-main);
    display: block;
}

/* =========================================================
   BOTTOM NAVIGATION BAR (SAFARI ELEVATED & TOUCH SAFE)
   ========================================================= */
.mobile-bottom-nav {
    flex-shrink: 0;
    background: #080c16;
    border-top: 1px solid var(--border-subtle);
    padding-top: 10px;
    padding-bottom: max(26px, calc(var(--safe-bottom) + 16px));
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 50;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.5);
}

.nav-item-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s, transform 0.15s;
    user-select: none;
}

.nav-item-btn:active {
    transform: scale(0.92);
}

.nav-item-btn.active {
    color: var(--color-orange);
}

.nav-item-icon {
    font-size: 20px;
    line-height: 1;
}

.nav-item-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

/* =========================================================
   LOGIN SCREEN (DEDICADO & LIMPO)
   ========================================================= */
#login-screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 99999;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
}

#login-screen.hidden {
    display: none !important;
}

/* =========================================================
   MODAIS & VIEWS OPACOS
   ========================================================= */
.mobile-fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 9999;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mobile-fullscreen-modal.hidden {
    display: none !important;
}

.modal-header-bar {
    flex-shrink: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding-top: max(12px, calc(var(--safe-top) + 8px));
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-scrollable-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px 140px;
}

.modal-fixed-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(6, 9, 17, 0.98);
    border-top: 1px solid var(--border-subtle);
    padding: 12px 16px max(24px, calc(var(--safe-bottom) + 14px));
    z-index: 10000;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.6);
}

.btn-modal-submit {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, var(--color-orange), #d15014);
    border: none;
    border-radius: 14px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 18px rgba(242, 101, 34, 0.4);
    cursor: pointer;
    transition: transform 0.15s;
}

.btn-modal-submit:active {
    transform: scale(0.98);
}

/* =========================================================
   CAMPOS DE FORMULÁRIO (INPUTS & CARDS INTERNOS)
   ========================================================= */
.form-section-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 14px;
}

.form-section-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-orange);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-input {
    width: 100%;
    height: 46px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 0 14px;
    color: var(--text-white);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.mobile-input:focus {
    border-color: var(--color-orange);
    box-shadow: 0 0 0 3px var(--color-orange-glow);
}

.mobile-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text-white);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    resize: none;
    margin-bottom: 8px;
}

.mobile-textarea:focus {
    border-color: var(--color-orange);
}

.mobile-select {
    width: 100%;
    height: 46px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 0 14px;
    color: var(--text-white);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    margin-bottom: 8px;
}

/* =========================================================
   CÂMERA & MINIATURAS
   ========================================================= */
.camera-trigger-btn {
    width: 100%;
    height: 48px;
    background: rgba(26, 38, 64, 0.7);
    border: 2px dashed var(--border-highlight);
    border-radius: 12px;
    color: var(--text-white);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.camera-trigger-btn:active {
    border-color: var(--color-orange);
    background: rgba(242, 101, 34, 0.1);
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.photo-thumb-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: #000000;
}

.photo-thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-red);
    color: #ffffff;
    border: none;
    font-weight: 900;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* =========================================================
   AUTOCOMPLETE DROPDOWN
   ========================================================= */
.autocomplete-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 50px;
    background: var(--bg-card);
    border: 1px solid var(--border-highlight);
    border-radius: 12px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

.autocomplete-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
}

.autocomplete-item:active {
    background: var(--bg-input);
}
