/* admin/css/admin.css */

:root {
  --sidebar-width: 260px;
  --bg-darker: #070707;
  --bg-dark: #0f0f0f;
  --bg-card: #151515;
  --border-light: rgba(255, 255, 255, 0.07);
  --color-green: #2ecc71;
  --color-blue: #3498db;
  --color-yellow: #f1c40f;
  --color-red: #e74c3c;
  --color-purple: #9b59b6;
}

body {
  background: var(--bg-darker);
  color: #f5f5f5;
  margin: 0;
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
}

/* Page Layout */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-dark);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-brand {
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  border-bottom: 1px solid var(--border-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.gold-icon {
  color: var(--color-gold);
  filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.5));
}

.sidebar-user {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-user .avatar {
  font-size: 2.2rem;
  color: #666;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-role {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
}

.user-status {
  font-size: 0.75rem;
  color: var(--color-green);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.online-dot {
  font-size: 0.5rem;
}

.sidebar-menu {
  padding: 1.5rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-grow: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  color: #bbb;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.menu-item i {
  width: 20px;
  text-align: center;
}

.menu-item:hover, .menu-item.active {
  background: rgba(212, 175, 55, 0.08);
  color: var(--color-gold);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.btn-logout {
  width: 100%;
  background: rgba(231, 76, 60, 0.1);
  color: var(--color-red);
  border: 1px solid rgba(231, 76, 60, 0.2);
  padding: 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-logout:hover {
  background: var(--color-red);
  color: #fff;
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main-header {
  padding: 1.5rem 2.5rem;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main-header h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
}

.content-body {
  padding: 2.5rem;
  flex-grow: 1;
}

/* SPA Sections toggling */
.view-section {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.bg-gold-dim { background: rgba(212, 175, 55, 0.1); color: var(--color-gold); }
.bg-green-dim { background: rgba(46, 204, 113, 0.1); color: var(--color-green); }
.bg-blue-dim { background: rgba(52, 152, 219, 0.1); color: var(--color-blue); }

.stat-info h3 {
  margin: 0 0 0.2rem;
  font-size: 0.9rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1.5fr 1fr;
  }
}

/* Cards styles */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 1.8rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.chart-card h3, .activity-card h3, .table-card h3 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
  border-left: 3px solid var(--color-gold);
  padding-left: 0.8rem;
}

/* Pure CSS Bar Chart */
.chart-container {
  height: 250px;
  display: flex;
  align-items: flex-end;
  padding-top: 1rem;
}

.bar-chart {
  display: flex;
  width: 100%;
  height: 100%;
  justify-content: space-around;
  align-items: flex-end;
  border-bottom: 2px solid rgba(255,255,255,0.1);
  padding-bottom: 0.5rem;
}

.chart-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 40px;
}

.chart-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--color-gold), rgba(212, 175, 55, 0.2));
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: height 1s ease-in-out;
  min-height: 5px;
}

.chart-bar:hover {
  filter: brightness(1.2);
}

.chart-tooltip {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.chart-label {
  font-size: 0.75rem;
  color: #888;
}

/* Activity List */
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.activity-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  position: relative;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border-light);
}

.activity-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-gold);
  box-shadow: 0 0 5px var(--color-gold);
}

.activity-text {
  font-size: 0.9rem;
  color: #eee;
}

.activity-time {
  font-size: 0.75rem;
  color: #666;
}

/* Tables Styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.admin-table th {
  background: rgba(255,255,255,0.02);
  color: #888;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  color: #ddd;
  font-size: 0.9rem;
}

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

/* Status Badges */
.badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pendiente { background: rgba(241, 196, 15, 0.1); color: var(--color-yellow); }
.badge-en-revision { background: rgba(155, 89, 182, 0.1); color: var(--color-purple); }
.badge-preseleccionada { background: rgba(52, 152, 219, 0.1); color: var(--color-blue); }
.badge-finalista { background: rgba(212, 175, 55, 0.15); color: var(--color-gold); border: 1px solid var(--color-gold); }
.badge-aprobada { background: rgba(46, 204, 113, 0.1); color: var(--color-green); }
.badge-rechazada { background: rgba(231, 76, 60, 0.1); color: var(--color-red); }

/* Form Fields & Controls */
.filter-bar {
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.filter-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.2rem;
}

.filter-group, .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label, .form-group label {
  font-size: 0.85rem;
  color: #bbb;
  font-weight: 500;
}

.filter-group input, .filter-group select,
.form-group input, .form-group select, .form-group textarea {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0.75rem;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s;
}

.filter-group input:focus, .form-group input:focus, .form-group textarea:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
}

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

/* Buttons */
.btn-secondary-outline {
  border: 1px solid var(--border-light);
  color: #ccc;
  background: transparent;
}

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

/* Actions cell buttons */
.btn-action-group {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  background: transparent;
  color: #ccc;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: rgba(255,255,255,0.05);
}

.btn-icon.btn-view:hover { color: var(--color-blue); border-color: rgba(52, 152, 219, 0.3); }
.btn-icon.btn-edit:hover { color: var(--color-gold); border-color: rgba(212, 175, 55, 0.3); }
.btn-icon.btn-delete:hover { color: var(--color-red); border-color: rgba(231, 76, 60, 0.3); }

/* Drawers & Modals */
.drawer, .modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(5px);
  z-index: 200;
  animation: fadeIn 0.3s forwards;
}

.drawer-content {
  position: absolute;
  top: 0; right: 0;
  width: 100%;
  max-width: 500px;
  height: 100%;
  border-radius: 0;
  border-left: 1px solid var(--border-light);
  overflow-y: auto;
  padding: 2.5rem;
}

.close-drawer, .close-modal {
  position: absolute;
  top: 1.5rem; right: 1.5rem;
  font-size: 2rem;
  color: #888;
  cursor: pointer;
  transition: color 0.2s;
}

.close-drawer:hover, .close-modal:hover {
  color: #fff;
}

.modal-content {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.5rem;
}

.drawer-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detail-img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.detail-row label {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-row span {
  font-size: 1rem;
  color: #eee;
  font-weight: 500;
}

/* Media Gallery in Admin */
.gallery-thumbnail {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

/* Print/PDF Export styling */
@media print {
  body * {
    visibility: hidden;
  }
  #view-inscripciones, #view-inscripciones * {
    visibility: visible;
  }
  #view-inscripciones {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
  }
  .filter-bar, .export-buttons {
    display: none !important;
  }
}
