/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Role-based visibility - hide restricted items by default to prevent flash */
.admin-only,
.manager-admin-only {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: white;
  padding: 0.75rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: visible;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.nav {
  display: flex;
  list-style: none;
  gap: 0.5rem;
}

.nav a {
  color: white;
  text-decoration: none;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.nav a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #3498db;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav a:hover::before, .nav a.active::before {
  width: 80%;
}

.nav a:hover, .nav a.active {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.nav a.active {
  background-color: rgba(52, 152, 219, 0.2);
  color: #3498db;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.9;
}

.nav-icon {
  font-size: 1.1rem;
  opacity: 0.8;
}

.nav-text {
  font-size: 0.9rem;
}

/* Mobile navigation toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.nav-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Responsive navigation adjustments */
@media (max-width: 1024px) {
  .nav a {
    padding: 0.5rem 0.6rem;
  }
  
  .nav-text {
    font-size: 0.8rem;
  }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
    order: 2;
  }
  
  .header-content {
    flex-wrap: wrap;
    position: relative;
  }
  
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    flex-direction: column;
    padding: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    gap: 0;
    width: 100%;
    order: 3;
    flex-basis: 100%;
    z-index: 1000;
  }
  
  .nav.active {
    max-height: 500px;
    opacity: 1;
    padding: 1rem;
  }
  
  .nav a {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    justify-content: flex-start;
    gap: 0.75rem;
    font-size: 0.9rem;
    background-color: rgba(255, 255, 255, 0.05);
    margin-bottom: 0.25rem;
  }
  
  .nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: none;
  }
  
  .nav-icon {
    font-size: 1.1rem;
  }
  
  .nav-text {
    font-size: 0.85rem;
    line-height: 1;
    display: inline;
  }
}

.btn-logout {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  background: #c0392b;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Mobile navigation */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Forms */
.form-container {
  max-width: 500px;
  margin: 2rem auto;
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

/* Form validation styles */
.form-control.error {
  border-color: #e74c3c;
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.field-error {
  margin-top: 0.25rem;
  color: #e74c3c;
  font-size: 0.875rem;
}

.field-error small {
  display: block;
  margin-bottom: 0.25rem;
}

/* Enhanced alert styles */
.alert-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 400px;
}

.alert {
  position: relative;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background: white;
  animation: slideInRight 0.3s ease-out;
}

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

.alert-success {
  border-color: #27ae60;
  background-color: #d5f4e6;
  color: #1e8449;
}

.alert-error {
  border-color: #e74c3c;
  background-color: #fadbd8;
  color: #c0392b;
}

.alert-warning {
  border-color: #f39c12;
  background-color: #fdeaa7;
  color: #d68910;
}

.alert-info {
  border-color: #3498db;
  background-color: #d6eaf8;
  color: #2471a3;
}

.alert-message {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.alert-details {
  margin: 0.5rem 0 0 0;
  padding-left: 1rem;
  font-size: 0.875rem;
  opacity: 0.9;
}

.alert-details li {
  margin-bottom: 0.25rem;
}

.alert-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  font-weight: bold;
  color: inherit;
  cursor: pointer;
  opacity: 0.6;
  line-height: 1;
}

.alert-close:hover {
  opacity: 1;
}
}

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

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-control.error {
  border-color: #e74c3c;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color 0.3s;
  text-align: center;
}

.btn:hover {
  background: #2980b9;
}

.btn-primary {
  background: #3498db;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-success {
  background: #27ae60;
}

.btn-success:hover {
  background: #229954;
}

.btn-danger {
  background: #e74c3c;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-secondary {
  background: #95a5a6;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.btn-block {
  width: 100%;
}

/* Tables */
.table-container {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin: 2rem 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
}

.table tbody tr:hover {
  background: #f8f9fa;
  cursor: pointer;
}

/* Status indicators */
.status {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
}

.status-received { background: #e3f2fd; color: #1976d2; }
.status-cutting_done { background: #f3e5f5; color: #7b1fa2; }
.status-smocking { background: #fff3e0; color: #f57c00; }
.status-smocking_done { background: #fff8e1; color: #fbc02d; }
.status-sewing { background: #e8f5e8; color: #388e3c; }
.status-sewing_done { background: #e1f5fe; color: #0288d1; }
.status-botones { background: #fff3e0; color: #ef6c00; }
.status-decoracion { background: #f3e5f5; color: #8e24aa; }
.status-pending_qc { background: #fce4ec; color: #c2185b; }
.status-rejected { background: #ffebee; color: #d32f2f; }
.status-approved { background: #e8f5e8; color: #2e7d32; }
.status-shipped { background: #f1f8e9; color: #558b2f; }
.status-in_process { background: #e3f2fd; color: #1976d2; }
.status-enviado_a_houston { background: #e8f5e8; color: #1b5e20; }
.status-enviado_a_cliente { background: #e0f2f1; color: #00695c; }

/* Priority indicators */
.priority-overdue {
  background: #f5f5f5 !important;
  border-left: 4px solid #d32f2f;
  color: #d32f2f !important;
  font-weight: bold !important;
}

.priority-overdue:hover {
  background: #eeeeee !important;
}

.priority-overdue td {
  color: #d32f2f !important;
  font-weight: bold !important;
}

.priority-high {
  background: #ffebee !important;
  border-left: 4px solid #f44336;
}

.priority-high:hover {
  background: #ffcdd2 !important;
}

.priority-medium {
  background: #fff8e1 !important;
  border-left: 4px solid #ff9800;
}

.priority-medium:hover {
  background: #ffecb3 !important;
}

.priority-normal {
  background: white;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2c3e50;
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Loading spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
    font-size: 12pt;
  }
  
  .header, .nav, .btn {
    display: none;
  }
  
  .container {
    max-width: none;
    padding: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }
  
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-toggle {
    display: block;
    position: absolute;
    top: 1rem;
    right: 1rem;
  }
  
  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
  }
  
  .nav.active {
    display: flex;
  }
  
  .nav a {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .form-container {
    margin: 1rem auto;
    padding: 1.5rem;
  }
  
  .table-container {
    overflow-x: auto;
  }
  
  .table {
    min-width: 600px;
  }
  
  .card {
    padding: 1rem;
  }
  
  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .btn-group .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .form-container {
    padding: 1rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem;
    font-size: 0.9rem;
  }
  
  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
  
  /* Mobile action buttons - more compact */
  .action-buttons .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    min-width: auto;
  }
  
  .action-buttons .btn-icon {
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* Button icons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-icon .icon {
  font-size: 1rem;
  line-height: 1;
}

/* Mobile-specific button styles */
@media (max-width: 480px) {
  .action-buttons, .item-actions {
    flex-wrap: wrap;
  }
  
  .action-buttons .btn, .item-actions .btn {
    padding: 0.3rem 0.4rem;
    font-size: 0.7rem;
    min-width: auto;
  }
  
  .action-buttons .btn-icon .icon, .item-actions .btn-icon .icon {
    font-size: 0.9rem;
  }
  
  /* Hide button text on very small screens, show only icons */
  .action-buttons .btn-text, .item-actions .btn-text {
    display: none;
  }
  
  .action-buttons .btn-icon, .item-actions .btn-icon {
    padding: 0.4rem;
    gap: 0;
  }
  
  /* Keep back button text visible */
  .btn-secondary .btn-text {
    display: inline;
  }
  
  /* Item action buttons - even smaller on mobile */
  .item-actions .btn-small {
    padding: 0.2rem 0.3rem;
    font-size: 0.65rem;
  }
  
  .item-actions .btn-icon {
    padding: 0.3rem;
  }
}

/* Medium mobile screens - show shortened text */
@media (max-width: 600px) and (min-width: 481px) {
  .action-buttons .btn, .item-actions .btn {
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .item-actions .btn-small {
    padding: 0.3rem 0.4rem;
    font-size: 0.7rem;
  }
}

/* Order form specific styles */
.order-items {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.order-item {
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #f9f9f9;
}

.order-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.remove-item {
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1.2rem;
}

.add-item {
  background: #27ae60;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 1rem;
}

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

/* Input Group Styles for Currency Fields */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group-addon {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  background-color: #e9ecef;
  border: 1px solid #ddd;
  border-right: none;
  border-radius: 4px 0 0 4px;
  font-weight: 500;
  color: #495057;
  white-space: nowrap;
}

.input-group .form-control {
  border-radius: 0 4px 4px 0;
  border-left: none;
}

.input-group .form-control:focus {
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Form Text Helper */
.form-text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #6c757d;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Delivery method indicators */
.delivery-method {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-block;
  white-space: nowrap;
}

.delivery-method.direct-ship {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.delivery-method.holding-location {
  background-color: #e2e3e5;
  color: #383d41;
  border: 1px solid #d1ecf1;
}