/**
 * BHENITO PORTAL - DESIGN SYSTEM
 * Version: 1.0
 * Date: January 2025
 */

/* Premium Typography (global)
   - Keeps Playfair Display for headings (already used across pages)
   - Upgrades body to Inter for a cleaner, more modern premium feel */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* =====================================================
   COLOR PALETTE
   ===================================================== */

:root {
  /* Primary Colors */
  --bhenito-dark: #0A122A;
  --bhenito-gold: #D4AF37;
  --bhenito-gray: #f4f5f7;
  --bhenito-text: #1c1c1c;
  --bhenito-white: #ffffff;
  
  /* Semantic Colors */
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-error: #ef4444;
  --color-error-light: #fee2e2;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-info: #3b82f6;
  --color-info-light: #dbeafe;
  
  /* Typography */
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Inter', 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  
  --text-4xl: 2.25rem;    /* 36px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-xl: 1.25rem;     /* 20px */
  --text-lg: 1.125rem;    /* 18px */
  --text-base: 1rem;      /* 16px */
  --text-sm: 0.875rem;    /* 14px */
  --text-xs: 0.75rem;     /* 12px */
  
  --font-light: 300;
  --font-normal: 400;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Spacing (8px grid) */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  
  /* Breakpoints */
  --breakpoint-mobile: 768px;
  --breakpoint-tablet: 1024px;
  --breakpoint-desktop: 1440px;
  
  /* Sidebar */
  --sidebar-width: 280px;
}

/* =====================================================
   GLOBAL RESET & BASE STYLES
   ===================================================== */

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

body {
  font-family: var(--font-body);
  color: var(--bhenito-text);
  line-height: 1.6;
  background-color: var(--bhenito-gray);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--bhenito-dark);
  font-weight: var(--font-bold);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
  display: inline-block;
  padding: var(--space-3) var(--space-6);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  text-align: center;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--bhenito-gold);
  color: var(--bhenito-dark);
}

.btn-primary:hover {
  background: #B8860B;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  color: var(--bhenito-dark);
  border: 2px solid var(--bhenito-dark);
}

.btn-secondary:hover {
  background: var(--bhenito-dark);
  color: var(--bhenito-white);
}

.btn-danger {
  background: var(--color-error);
  color: var(--bhenito-white);
}

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

.btn-small {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

.btn-large {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

/* =====================================================
   INPUTS
   ===================================================== */

.input-group {
  margin-bottom: var(--space-4);
}

.input-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--bhenito-dark);
}

.input-label.required::after {
  content: ' *';
  color: var(--color-error);
}

.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: var(--text-base);
  font-family: var(--font-body);
  transition: all 0.2s ease;
  background: var(--bhenito-white);
}

.input:focus {
  outline: none;
  border-color: var(--bhenito-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.input-error {
  border-color: var(--color-error);
}

.input-error:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-error-message {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-error);
}

.input:disabled {
  background: #f3f4f6;
  cursor: not-allowed;
}

/* =====================================================
   CARDS
   ===================================================== */

.card {
  background: var(--bhenito-white);
  border-radius: 12px;
  padding: var(--space-6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-kpi {
  background: var(--bhenito-white);
  border-radius: 12px;
  padding: var(--space-6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.card-kpi:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.card-kpi-title {
  font-size: var(--text-sm);
  color: #6b7280;
  margin-bottom: var(--space-2);
  font-weight: var(--font-normal);
}

.card-kpi-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--bhenito-dark);
  line-height: 1.2;
}

/* =====================================================
   TABLES
   ===================================================== */

.table-container {
  background: var(--bhenito-white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.table thead {
  background: var(--bhenito-gray);
}

.table th {
  padding: var(--space-4);
  text-align: left;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--bhenito-dark);
}

.table td {
  padding: var(--space-4);
  border-top: 1px solid #e5e7eb;
  font-size: var(--text-sm);
}

.table tbody tr:hover {
  background: #f9fafb;
}

/* Mobile table becomes cards */
@media (max-width: 768px) {
  .table-container {
    display: block;
  }
  
  .table, .table thead, .table tbody, .table th, .table td, .table tr {
    display: block;
  }
  
  .table thead {
    display: none;
  }
  
  .table tr {
    margin-bottom: var(--space-4);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: var(--space-4);
    background: var(--bhenito-white);
  }
  
  .table td {
    border: none;
    padding: var(--space-2) 0;
    text-align: right;
  }
  
  .table td::before {
    content: attr(data-label);
    float: left;
    font-weight: var(--font-semibold);
    color: var(--bhenito-dark);
  }
}

/* =====================================================
   MODALS
   ===================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
}

.modal {
  background: var(--bhenito-white);
  border-radius: 12px;
  padding: var(--space-6);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}

.modal-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--bhenito-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--text-2xl);
  cursor: pointer;
  color: #6b7280;
  padding: var(--space-2);
  line-height: 1;
}

.modal-close:hover {
  color: var(--bhenito-dark);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

/* =====================================================
   BADGES
   ===================================================== */

.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: 12px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.badge-error {
  background: var(--color-error-light);
  color: var(--color-error);
}

.badge-warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.badge-info {
  background: var(--color-info-light);
  color: var(--color-info);
}

/* =====================================================
   LOADING STATES
   ===================================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: var(--space-4);
}

.skeleton-card {
  height: 120px;
}

.spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid var(--bhenito-gold);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

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

.btn-loading {
  position: relative;
  color: transparent;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* =====================================================
   EMPTY STATES
   ===================================================== */

.empty-state {
  text-align: center;
  padding: var(--space-16);
}

.empty-state-icon {
  font-size: 4rem;
  color: #9ca3af;
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--bhenito-dark);
  margin-bottom: var(--space-2);
}

.empty-state-message {
  font-size: var(--text-base);
  color: #6b7280;
  margin-bottom: var(--space-6);
}

.empty-state-action {
  margin-top: var(--space-6);
}

/* =====================================================
   ERROR STATES
   ===================================================== */

.error-message {
  background: var(--color-error-light);
  color: var(--color-error);
  padding: var(--space-4);
  border-radius: 8px;
  border-left: 4px solid var(--color-error);
  margin-bottom: var(--space-4);
}

.error-message-title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.error-message-text {
  font-size: var(--text-sm);
}

/* =====================================================
   UTILITIES
   ===================================================== */

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}







