/* 
 * SAMAPE - CSS Mobile Otimizado e Limpo
 * Versão mobile otimizada com paleta de cores desktop
 * Foco em usabilidade, performance e telas pequenas
 */

/* ===== VARIÁVEIS DE CORES - ALINHADAS COM DESKTOP ===== */
:root {
  /* Cores principais alinhadas com desktop */
  --primary-dark: #1e1e1e;
  --card-bg: #242424;
  --darker-bg: #171717;
  --accent-pink: #f85d8e;
  --success-green: #37d09e;
  --warning-orange: #ff9353;
  --info-blue: #4285f4;
  --danger-red: #dc3545;
  
  /* Cores de texto */
  --text-light: #f0f0f0;
  --text-white: #ffffff;
  --text-muted: #a0a0a0;
  --text-disabled: #666666;
  
  /* Cores de borda */
  --border-light: #333333;
  --border-dark: #1a1a1a;
  
  /* Configurações mobile */
  --mobile-padding: 16px;
  --mobile-margin: 12px;
  --border-radius: 8px;
  --touch-target: 44px;
  --transition: all 0.2s ease;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===== ESTILOS GERAIS MOBILE ===== */
@media (max-width: 991.98px) {
  
  /* Reset e otimizações */
  * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
  
  html {
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
  }
  
  body {
    background-color: var(--primary-dark);
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.4;
    padding-bottom: 80px; /* Espaço para bottom nav */
    margin: 0;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  
  /* ===== LAYOUT PRINCIPAL ===== */
  
  /* Oculta sidebar em mobile */
  .sidebar {
    display: none !important;
  }
  
  /* Main content ocupa toda largura */
  .col-md-9, .col-lg-10 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  /* Container otimizado */
  .container-fluid {
    padding-left: var(--mobile-padding);
    padding-right: var(--mobile-padding);
    max-width: 100%;
  }
  
  /* ===== NAVBAR MOBILE ===== */
  
  .navbar {
    padding: 8px var(--mobile-padding);
    background-color: var(--primary-dark) !important;
    border-bottom: 1px solid var(--border-light);
    min-height: 56px;
  }
  
  .navbar-brand {
    font-size: 1.1rem;
    padding: 0;
  }
  
  .navbar-brand img {
    max-width: 120px;
    height: auto;
  }
  
  .navbar-toggler {
    border: none;
    padding: 4px 8px;
  }
  
  .navbar-toggler:focus {
    box-shadow: none;
  }
  
  /* ===== CARDS OTIMIZADOS ===== */
  
  .card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: var(--mobile-margin);
    transition: var(--transition);
  }
  
  .card:active {
    transform: scale(0.98);
  }
  
  .card-header {
    background-color: var(--card-bg);
    color: var(--text-light);
    border-bottom: 1px solid var(--border-light);
    padding: var(--mobile-margin) var(--mobile-padding);
    font-weight: 500;
    font-size: 0.95rem;
  }
  
  .card-body {
    padding: var(--mobile-padding);
  }
  
  .card-footer {
    padding: var(--mobile-margin) var(--mobile-padding);
    background-color: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-light);
  }
  
  /* ===== BOTÕES OTIMIZADOS ===== */
  
  .btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    text-decoration: none;
  }
  
  .btn:active {
    transform: scale(0.95);
  }
  
  .btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    min-height: 36px;
  }
  
  .btn-primary {
    background-color: var(--accent-pink);
    color: var(--text-white);
  }
  
  .btn-success {
    background-color: var(--success-green);
    color: var(--text-white);
  }
  
  .btn-warning {
    background-color: var(--warning-orange);
    color: var(--text-white);
  }
  
  .btn-danger {
    background-color: var(--danger-red);
    color: var(--text-white);
  }
  
  /* ===== FORMULÁRIOS ===== */
  
  .form-control, .form-select {
    background-color: var(--darker-bg);
    border: 1px solid var(--border-light);
    color: var(--text-light);
    border-radius: var(--border-radius);
    padding: 14px var(--mobile-padding);
    font-size: 16px; /* Evita zoom iOS */
    min-height: var(--touch-target);
    transition: var(--transition);
  }
  
  .form-control:focus, .form-select:focus {
    background-color: var(--card-bg);
    border-color: var(--accent-pink);
    color: var(--text-light);
    box-shadow: 0 0 0 2px rgba(248, 93, 142, 0.25);
    outline: none;
  }
  
  .form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
  }
  
  .form-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 5px;
  }
  
  /* ===== TABELAS RESPONSIVAS ===== */
  
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: var(--mobile-margin);
  }
  
  .table {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--text-light);
  }
  
  .table th {
    border-top: none;
    border-bottom: 2px solid var(--border-light);
    padding: 12px 8px;
    font-weight: 600;
    font-size: 0.8rem;
    background-color: var(--darker-bg);
  }
  
  .table td {
    padding: 12px 8px;
    border-top: 1px solid var(--border-light);
    vertical-align: middle;
    background-color: var(--card-bg);
  }
  
  /* Tabelas em formato card para telas muito pequenas */
  @media (max-width: 576px) {
    .table-mobile-cards thead {
      display: none;
    }
    
    .table-mobile-cards tbody,
    .table-mobile-cards tr {
      display: block;
    }
    
    .table-mobile-cards tr {
      background-color: var(--card-bg);
      border-radius: var(--border-radius);
      margin-bottom: var(--mobile-margin);
      padding: var(--mobile-padding);
      box-shadow: var(--shadow);
    }
    
    .table-mobile-cards td {
      display: flex;
      justify-content: space-between;
      padding: 8px 0;
      border: none;
    }
    
    .table-mobile-cards td:before {
      content: attr(data-label) ": ";
      font-weight: 600;
      color: var(--text-muted);
    }
  }
  
  /* ===== BOTTOM NAVIGATION ===== */
  
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 12px 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    min-height: 70px;
  }
  
  .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-decoration: none;
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: var(--border-radius);
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    justify-content: center;
  }
  
  .nav-item:active {
    transform: scale(0.9);
    background-color: var(--darker-bg);
  }
  
  .nav-item.active {
    color: var(--accent-pink);
    background-color: rgba(248, 93, 142, 0.1);
  }
  
  .nav-item i {
    font-size: 1.3rem;
    margin-bottom: 2px;
  }
  
  .nav-item span {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
  }
  
  /* ===== MODAL MOBILE ===== */
  
  .mobile-menu-modal {
    background-color: var(--card-bg);
    border: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin-top: auto;
  }
  
  .mobile-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--mobile-margin);
    padding: var(--mobile-padding);
  }
  
  .menu-item-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--mobile-padding);
    background-color: var(--darker-bg);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-light);
    transition: var(--transition);
    min-height: 80px;
    justify-content: center;
  }
  
  .menu-item-mobile:hover,
  .menu-item-mobile:active {
    background-color: var(--primary-dark);
    color: var(--accent-pink);
    transform: scale(0.95);
  }
  
  .menu-item-mobile i {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }
  
  .menu-item-mobile span {
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
  }
  
  /* ===== PERFIL MOBILE ===== */
  
  .user-section-mobile {
    padding-top: var(--mobile-padding);
    border-top: 1px solid var(--border-light);
  }
  
  .user-info-mobile {
    display: flex;
    align-items: center;
    padding: var(--mobile-padding);
    background-color: var(--darker-bg);
    border-radius: var(--border-radius);
  }
  
  .profile-image-mobile {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: var(--mobile-margin);
  }
  
  .user-details-mobile {
    flex: 1;
  }
  
  .user-name-mobile {
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 2px;
  }
  
  .user-email-mobile {
    font-size: 0.8rem;
    color: var(--text-muted);
  }
  
  .user-role-mobile {
    font-size: 0.7rem;
    color: var(--accent-pink);
    text-transform: uppercase;
    font-weight: 500;
  }
  
  /* ===== ALERTS MOBILE ===== */
  
  .alert {
    border-radius: var(--border-radius);
    border: none;
    margin-bottom: var(--mobile-margin);
    padding: var(--mobile-padding);
    box-shadow: var(--shadow);
  }
  
  /* ===== DROPDOWNS ===== */
  
  .dropdown-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
  }
  
  .dropdown-item {
    color: var(--text-light);
    padding: 8px var(--mobile-padding);
    transition: var(--transition);
  }
  
  .dropdown-item:hover,
  .dropdown-item:active {
    background-color: var(--darker-bg);
    color: var(--accent-pink);
  }
  
  /* ===== BADGES E STATUS ===== */
  
  .badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
  }
  
  .status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .status-badge.pending {
    background-color: var(--warning-orange);
    color: var(--text-white);
  }
  
  .status-badge.completed {
    background-color: var(--success-green);
    color: var(--text-white);
  }
  
  .status-badge.cancelled {
    background-color: var(--danger-red);
    color: var(--text-white);
  }
  
  /* ===== UTILITÁRIOS ===== */
  
  /* Ocultar em mobile */
  .d-mobile-none {
    display: none !important;
  }
  
  /* Mostrar apenas em mobile */
  .d-mobile-only {
    display: block !important;
  }
  
  /* Loading states */
  .loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-pink);
    animation: spin 1s ease-in-out infinite;
  }
  
  @keyframes spin {
    to { transform: rotate(360deg); }
  }
  
  /* ===== HEADINGS MOBILE ===== */
  
  h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.8rem;
    line-height: 1.3;
    color: var(--text-light);
  }
  
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.2rem; }
  h4 { font-size: 1.1rem; }
  h5 { font-size: 1rem; }
  h6 { font-size: 0.9rem; }
  
  /* ===== CORREÇÕES ESPECÍFICAS ===== */
  
  /* Links */
  a {
    color: var(--accent-pink);
    text-decoration: none;
  }
  
  a:hover {
    color: var(--text-light);
  }
  
  /* Text utilities */
  .text-muted {
    color: var(--text-muted) !important;
  }
  
  /* Background utilities */
  .bg-dark {
    background-color: var(--primary-dark) !important;
  }
  
  .bg-secondary {
    background-color: var(--card-bg) !important;
  }
  
  /* Border utilities */
  .border {
    border: 1px solid var(--border-light) !important;
  }
  
  /* ===== SMOOTH SCROLLING ===== */
  
  html {
    scroll-behavior: smooth;
  }
  
  /* Custom scrollbar */
  ::-webkit-scrollbar {
    width: 4px;
  }
  
  ::-webkit-scrollbar-track {
    background: var(--darker-bg);
  }
  
  ::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
  }
}

/* ===== MEDIA QUERIES ESPECÍFICAS ===== */

/* Telas muito pequenas (iPhone SE, etc.) */
@media (max-width: 375px) {
  :root {
    --mobile-padding: 12px;
    --mobile-margin: 8px;
  }
  
  .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }
  
  .card-body {
    padding: 12px;
  }
}

/* Telas médias de mobile (iPhone 12, etc.) */
@media (min-width: 376px) and (max-width: 767px) {
  .mobile-menu-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablets em portrait */
@media (min-width: 768px) and (max-width: 991px) {
  .mobile-menu-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .mobile-bottom-nav {
    display: none;
  }
}