/* ============================================
   TINTA Y PINTA TATTOO — Estilos principales
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #e94560;
  --primary-dark: #c73652;
  --primary-light: #fde8ec;
  --dark: #1a1a2e;
  --dark-2: #16213e;
  --accent: #0f3460;
  --bg: #f7f7f8;
  --bg-card: #ffffff;
  --border: #e5e5e7;
  --text: #1a1a2e;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- LOGIN ---- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-container {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  display: inline-flex;
  margin-bottom: 12px;
}

.login-logo h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-2);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-3);
}

/* ---- NAVBAR ---- */
.navbar {
  background: var(--dark);
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: white;
  margin-right: 12px;
  white-space: nowrap;
}

.navbar-menu {
  display: flex;
  list-style: none;
  gap: 2px;
  flex: 1;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.navbar-menu a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.navbar-menu a:hover,
.navbar-menu a.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.navbar-menu a.active {
  background: var(--primary);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
}

.user-name {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}

.user-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.user-badge.admin {
  background: var(--primary);
  color: white;
}

.user-badge.operador {
  background: rgba(255,255,255,0.15);
  color: white;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.btn-logout:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}

.navbar-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}

.navbar-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
}

/* ---- LAYOUT PRINCIPAL ---- */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

/* ---- CARDS ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
}

.card-body {
  padding: 20px;
}

/* ---- STAT CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
}

.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--danger); }
.stat-value.blue { color: var(--info); }

.stat-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ---- FORMULARIOS ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(233,69,96,0.12);
}

.input-icon-right {
  position: relative;
}

.input-icon-right input {
  padding-right: 40px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  padding: 4px;
  display: flex;
  align-items: center;
}

/* ---- BOTONES ---- */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-secondary:hover { background: #ebebeb; }

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

.btn-success {
  background: var(--success);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-block { width: 100%; justify-content: center; }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.edit:hover { color: var(--info); border-color: var(--info); }
.btn-icon.delete:hover { color: var(--danger); border-color: var(--danger); }

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- TABLA ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

tfoot td {
  padding: 10px 14px;
  font-weight: 600;
  background: var(--bg);
  border-top: 2px solid var(--border);
}

/* ---- ALERTAS ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border-left: 3px solid;
}

.alert-error {
  background: var(--danger-light);
  color: #991b1b;
  border-color: var(--danger);
}

.alert-success {
  background: var(--success-light);
  color: #065f46;
  border-color: var(--success);
}

.alert-warning {
  background: var(--warning-light);
  color: #92400e;
  border-color: var(--warning);
}

.alert-info {
  background: var(--info-light);
  color: #1e40af;
  border-color: var(--info);
}

/* ---- BADGES ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-green { background: var(--success-light); color: #065f46; }
.badge-red { background: var(--danger-light); color: #991b1b; }
.badge-amber { background: var(--warning-light); color: #92400e; }
.badge-blue { background: var(--info-light); color: #1e40af; }
.badge-gray { background: #f3f4f6; color: #374151; }

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  padding: 4px;
  border-radius: 4px;
  font-size: 20px;
  line-height: 1;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- UTILIDADES ---- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-2); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-2);
}

.empty-state svg {
  opacity: 0.3;
  margin-bottom: 12px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .navbar-toggle { display: flex; }
  .navbar-menu {
    display: none;
    position: absolute;
    top: 58px;
    left: 0;
    right: 0;
    background: var(--dark);
    flex-direction: column;
    padding: 12px;
    gap: 4px;
    z-index: 99;
  }
  .navbar-menu.open { display: flex; }
  .navbar-user { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-wrapper { padding: 16px; }
  .modal { margin: 0; border-radius: 14px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
