/* ==========================================================================
   GAONA CONSULTORES TI - CRM & ADMIN DASHBOARD STYLESHEET
   ========================================================================== */

:root {
  --admin-bg: #070b14;
  --admin-sidebar-bg: #0b1324;
  --admin-card-bg: rgba(15, 23, 42, 0.85);
  --admin-surface-elevated: #1a2540;
  --admin-border: rgba(255, 255, 255, 0.08);
  --admin-border-focus: #00f2fe;

  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --grad-primary: linear-gradient(135deg, #00f2fe 0%, #4facfe 50%, #6366f1 100%);
  --grad-surface: linear-gradient(145deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --text-pure: #ffffff;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(0, 242, 254, 0.2);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--admin-bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ==========================================================================
   1. LOGIN SCREEN / PORTAL DE ACCESO
   ========================================================================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background-image: 
    radial-gradient(at 0% 0%, rgba(0, 242, 254, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.1) 0px, transparent 50%);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--admin-sidebar-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  position: relative;
  backdrop-filter: blur(16px);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.login-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.5));
}

.login-logo span {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-pure);
}

.login-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-pure);
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.admin-input, .admin-select, .admin-textarea {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  background: rgba(7, 11, 20, 0.8);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  color: var(--text-pure);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.admin-input.no-icon, .admin-select, .admin-textarea {
  padding-left: 1rem;
}

.admin-input:focus, .admin-select:focus, .admin-textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 242, 254, 0.15);
  background: rgba(13, 21, 39, 0.95);
}

.password-toggle-btn {
  position: absolute;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.password-toggle-btn:hover {
  color: var(--accent-cyan);
}

.login-alert {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #ff8095;
  font-size: 0.82rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.login-demo-hint {
  margin-top: 1.5rem;
  padding: 0.85rem;
  background: rgba(0, 242, 254, 0.05);
  border: 1px dashed rgba(0, 242, 254, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   2. MAIN ADMIN LAYOUT
   ========================================================================== */
.admin-app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--admin-sidebar-bg);
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all var(--transition-normal);
  z-index: 100;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-nav {
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.75rem 0.65rem 0.25rem 0.65rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.sidebar-link:hover {
  color: var(--text-pure);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-link.active {
  color: #070b14;
  background: var(--grad-primary);
  font-weight: 700;
}

.sidebar-link.active .sidebar-icon {
  color: #070b14;
}

.sidebar-icon {
  font-size: 1.1rem;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #070b14;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-pure);
  line-height: 1.1;
}

.user-info p {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition-fast);
}

.logout-btn:hover {
  color: var(--accent-rose);
}

/* Main Content Area */
.admin-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  height: 64px;
  border-bottom: 1px solid var(--admin-border);
  background: rgba(11, 19, 36, 0.7);
  backdrop-filter: blur(12px);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.topbar-title-box h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-pure);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.content-body {
  padding: 1.75rem 2rem;
  flex-grow: 1;
  overflow-y: auto;
}

/* ==========================================================================
   3. KPI STATS CARDS
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.kpi-card:hover {
  border-color: rgba(0, 242, 254, 0.3);
  transform: translateY(-2px);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-cyan);
}

.kpi-card:nth-child(2)::before { background: var(--accent-blue); }
.kpi-card:nth-child(3)::before { background: var(--accent-emerald); }
.kpi-card:nth-child(4)::before { background: var(--accent-purple); }

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.kpi-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-icon {
  font-size: 1.1rem;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-pure);
  line-height: 1.1;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--accent-emerald);
  margin-top: 0.35rem;
}

/* ==========================================================================
   4. CONTROLS BAR (SEARCH, FILTERS, VIEW SWITCH)
   ========================================================================== */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.search-box {
  position: relative;
  width: 320px;
  max-width: 100%;
}

.search-box input {
  padding-left: 2.3rem;
  padding-right: 1rem;
  height: 38px;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-select {
  height: 38px;
  background: var(--admin-sidebar-bg);
  border: 1px solid var(--admin-border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0 0.85rem;
  font-size: 0.82rem;
}

.view-switch {
  display: flex;
  background: var(--admin-sidebar-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.view-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.view-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-pure);
}

/* ==========================================================================
   5. KANBAN BOARD SYSTEM
   ========================================================================== */
.kanban-board {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  padding-bottom: 1.5rem;
  min-height: calc(100vh - 340px);
}

.kanban-column {
  flex: 0 0 310px;
  background: rgba(11, 19, 36, 0.6);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 300px);
  transition: all var(--transition-fast);
}

.kanban-column.drag-over {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.06);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
}

.column-header {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.column-title-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.column-color-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.col-prospect .column-color-indicator { background: var(--accent-blue); }
.col-diagnosis .column-color-indicator { background: var(--accent-amber); }
.col-proposal .column-color-indicator { background: var(--accent-indigo); }
.col-negotiation .column-color-indicator { background: var(--accent-purple); }
.col-won .column-color-indicator { background: var(--accent-emerald); }
.col-lost .column-color-indicator { background: var(--accent-rose); }

.column-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-pure);
}

.column-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.column-cards-container {
  padding: 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex-grow: 1;
}

/* Kanban Proposal Card */
.proposal-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: grab;
  transition: all var(--transition-fast);
  user-select: none;
  position: relative;
}

.proposal-card:active {
  cursor: grabbing;
}

.proposal-card:hover {
  border-color: rgba(0, 242, 254, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.proposal-card.dragging {
  opacity: 0.4;
  transform: scale(0.98);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.card-company {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-pure);
  line-height: 1.2;
}

.card-client {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.priority-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.priority-alta {
  background: rgba(244, 63, 94, 0.15);
  color: #ff8095;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.priority-media {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.priority-baja {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.card-service-tag {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.75rem;
}

.card-value {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-pure);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  gap: 0.35rem;
}

.action-icon-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-icon-btn:hover {
  background: rgba(0, 242, 254, 0.2);
  color: #fff;
}

/* ==========================================================================
   6. TABLE VIEW SYSTEM
   ========================================================================== */
.table-view-container {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: none;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th, .admin-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--admin-border);
}

.admin-table th {
  background: var(--admin-sidebar-bg);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   7. MODAL STYLES (PROPOSAL DETAILS & CREATE)
   ========================================================================== */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.85);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.admin-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.admin-modal-card {
  background: var(--admin-sidebar-bg);
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), var(--shadow-glow);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.admin-modal-backdrop.open .admin-modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--admin-border);
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--text-pure);
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.btn-admin {
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  transition: all var(--transition-fast);
}

.btn-admin-primary {
  background: var(--grad-primary);
  color: #070b14;
  font-weight: 700;
}

.btn-admin-primary:hover {
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4);
  transform: translateY(-1px);
}

.btn-admin-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--admin-border);
}

.btn-admin-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-admin-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #ff8095;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-admin-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

/* Responsive */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    left: -260px;
    height: 100vh;
  }

  .admin-sidebar.open {
    left: 0;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .modal-grid-2 {
    grid-template-columns: 1fr;
  }
}
