/* ============================================
   CASA APPLE - ENHANCED APPLE-INSPIRED DESIGN SYSTEM
   Premium, polished, and ultra-professional styling
   ============================================ */

/* Import the base styles */
@import url('apple-style.css');

/* ========== ENHANCED HEADER & NAVIGATION ========== */
.app-header {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
  padding: 10px 20px !important;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02), 0 2px 6px rgba(0, 0, 0, 0.03) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.app-header-left {
  gap: 12px !important;
}

.app-logo {
  width: 36px !important;
  height: 36px !important;
  border-radius: 10px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative;
}

.app-logo::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--apple-blue), #0051D5);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.app-logo:hover {
  transform: scale(1.05) translateY(-1px) !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.app-logo:hover::before {
  opacity: 0.1;
}

.app-title-main {
  font-size: 18px !important;
  letter-spacing: -0.015em !important;
  line-height: 1.2;
}

.app-title-sub {
  letter-spacing: 0.005em;
  margin-top: 1px;
  font-size: 11px !important;
}

/* Enhanced Navigation Links */
.app-nav {
  gap: 5px !important;
}

.app-nav a {
  padding: 6px 14px !important;
  letter-spacing: -0.008em;
  font-size: 14px !important;
  background: rgba(0, 0, 0, 0.03) !important;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.app-nav a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--apple-blue), #0051D5);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 0;
}

.app-nav a:hover {
  background: var(--apple-blue) !important;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 122, 255, 0.25), 0 1px 3px rgba(0, 122, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.1);
}

.app-nav a:hover::before {
  opacity: 1;
}

.app-nav a:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.2) !important;
}

.app-nav a.active {
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25) !important;
}

/* ========== ENHANCED BUTTONS ========== */
.btn {
  font-weight: 500 !important;
  letter-spacing: -0.008em;
  font-size: 14px !important;
  padding: 8px 16px !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  opacity: 0;
  transition: opacity 0.25s ease;
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--apple-blue), #0051D5) !important;
  box-shadow: 0 1px 4px rgba(0, 122, 255, 0.2) !important;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(0, 122, 255, 0.3), 0 1px 3px rgba(0, 122, 255, 0.2) !important;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 122, 255, 0.15) !important;
}

.btn-success {
  background: linear-gradient(135deg, var(--apple-green), #28A745) !important;
  box-shadow: 0 1px 4px rgba(52, 199, 89, 0.2) !important;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(52, 199, 89, 0.3), 0 1px 3px rgba(52, 199, 89, 0.2) !important;
}

.btn-danger {
  background: linear-gradient(135deg, var(--apple-red), #D11A2A) !important;
  box-shadow: 0 1px 4px rgba(255, 59, 48, 0.2) !important;
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(255, 59, 48, 0.3), 0 1px 3px rgba(255, 59, 48, 0.2) !important;
}

/* ========== ENHANCED CARDS ========== */
.page-card, .card {
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  padding: 18px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 18px rgba(0, 0, 0, 0.03) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.page-card:hover, .card:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.04) !important;
  transform: translateY(-1px);
}

/* ========== ENHANCED FORM INPUTS ========== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
  border: 1.5px solid var(--separator-medium) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  font-size: 14px !important;
  letter-spacing: -0.008em;
  padding: 8px 12px !important;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--apple-blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.08) !important;
  transform: translateY(-1px);
}
  border-color: var(--apple-blue) !important;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1), 0 1px 3px rgba(0, 122, 255, 0.08) !important;
  outline: none !important;
  transform: translateY(-1px);
}

/* ========== ENHANCED TABLES ========== */
table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

thead th {
  background: rgba(0, 0, 0, 0.02) !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
  text-transform: none !important;
  border-bottom: 2px solid rgba(0, 0, 0, 0.06) !important;
}

tbody tr {
  transition: all 0.2s ease !important;
}

tbody tr:hover {
  background: rgba(0, 122, 255, 0.03) !important;
  transform: scale(1.001);
}

/* ========== ENHANCED BADGES ========== */
.badge {
  font-weight: 600 !important;
  letter-spacing: -0.01em;
  padding: 4px 10px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease !important;
}

.badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12) !important;
}

/* ========== ENHANCED ANIMATIONS ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.fade-in-up {
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-in {
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-in {
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== ENHANCED MODALS ========== */
.modal {
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
}

.modal-content {
  border-radius: var(--radius-xl) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.20), 0 8px 24px rgba(0, 0, 0, 0.12) !important;
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== LOADING STATES ========== */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.03) 0%,
    rgba(0, 0, 0, 0.06) 50%,
    rgba(0, 0, 0, 0.03) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-md);
}

/* ========== SCROLLBAR STYLING ========== */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ========== ENHANCED RESPONSIVE ========== */
@media (max-width: 768px) {
  .app-logo {
    width: 40px !important;
    height: 40px !important;
  }
  
  .app-title-main {
    font-size: 18px !important;
  }
  
  .app-nav a {
    padding: 7px 14px !important;
    font-size: 13px !important;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 12px 16px !important;
  }
  
  .app-logo {
    width: 36px !important;
    height: 36px !important;
  }
  
  .app-title-main {
    font-size: 16px !important;
  }
  
  .app-title-sub {
    font-size: 12px !important;
  }
  
  .app-nav a {
    padding: 6px 12px !important;
    font-size: 12px !important;
  }
}

/* ========== FOCUS VISIBLE STYLES ========== */
*:focus-visible {
  outline: 2px solid var(--apple-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ========== SELECTION STYLING ========== */
::selection {
  background-color: rgba(0, 122, 255, 0.2);
  color: var(--text-primary);
}

::-moz-selection {
  background-color: rgba(0, 122, 255, 0.2);
  color: var(--text-primary);
}

/* ========== ORDERS TABLE OPTIMIZATIONS ========== */

/* Actions cell styling */
.actions-cell {
  min-width: 180px;
  position: relative;
  overflow: visible !important;
}

.actions-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.actions-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.btn-sm {
  padding: 4px 8px !important;
  font-size: 12px !important;
  min-width: 32px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Dropdown menu for more actions */
.actions-more {
  position: relative;
  display: inline-block;
  z-index: 10;
}

.actions-more.menu-open .btn-more {
  background-color: rgba(0, 122, 255, 0.1);
}

.btn-more {
  padding: 4px 10px !important;
  font-size: 16px !important;
  line-height: 1 !important;
  font-weight: bold !important;
  position: relative;
  z-index: 11;
}

.actions-dropdown {
  display: none;
  position: fixed !important;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 9999999 !important;
  animation: scaleIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  /* Prevent any hover interference */
  will-change: transform, opacity;
}

.actions-dropdown.show {
  display: block !important;
  pointer-events: auto !important;
}

.btn-dropdown {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  background: white;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-dropdown:last-child {
  border-bottom: none;
}

.btn-dropdown:hover {
  background-color: rgba(0, 122, 255, 0.05);
}

.btn-dropdown.btn-danger {
  color: var(--apple-red);
}

.btn-dropdown.btn-danger:hover {
  background-color: rgba(255, 59, 48, 0.05);
}

/* Mobile responsive table */
@media (max-width: 768px) {
  table {
    font-size: 12px !important;
  }
  
  th, td {
    padding: 8px 6px !important;
  }
  
  /* Hide less critical columns on mobile */
  table th:nth-child(6), /* Prometida */
  table td:nth-child(6),
  table th:nth-child(7), /* Técnico */
  table td:nth-child(7),
  table th:nth-child(8), /* IMEI */
  table td:nth-child(8) {
    display: none;
  }
  
  .actions-cell {
    min-width: 120px;
  }
  
  .actions-primary {
    flex-direction: row;
    justify-content: flex-start;
  }
  
  .btn-sm {
    padding: 6px 8px !important;
    min-width: 36px !important;
    height: 36px !important;
  }
  
  /* Ensure dropdown opens correctly on mobile */
  .actions-dropdown {
    right: auto;
    left: 0;
    min-width: 200px;
  }
}

@media (max-width: 480px) {
  /* Ultra-compact for very small screens */
  table {
    font-size: 11px !important;
  }
  
  th, td {
    padding: 6px 4px !important;
  }
  
  /* Stack client info vertically */
  .actions-primary {
    flex-wrap: wrap;
  }
  
  .btn-sm {
    font-size: 14px !important; /* Larger emoji on very small screens */
  }
  
  /* Hide priority column text, keep only icon in number */
  table th:nth-child(9),
  table td:nth-child(9) {
    display: none;
  }
}

/* REMOVED: Auto-hover functionality - dropdown now only opens on click */
/* This prevents the dropdown from appearing automatically when hovering */
