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

:root {
  --primary-purple: #6B46C1;
  --primary-orange: #FF6B35;
  --dark-purple: #4C1D95;
  --light-orange: #FFA07A;
  --white: #FFFFFF;
  --light-gray: #F8F9FA;
  --gray: #6B7280;
  --dark-gray: #374151;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-lg: rgba(0, 0, 0, 0.25);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--dark-gray);
  background: linear-gradient(135deg, var(--dark-purple) 0%, #8B4513 100%);
  min-height: 100vh;
}

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

/* ═══════════════════════════════════════
   HEADER
═══════════════════════════════════════ */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo h1 {
  background: linear-gradient(135deg, var(--primary-purple), var(--primary-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.campaign-name-header {
  color: rgba(107, 70, 193, 0.75);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-top: -2px;
  text-transform: uppercase;
}

.links-lock-notice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(107, 70, 193, 0.08);
  border: 1px solid rgba(107, 70, 193, 0.25);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  color: var(--dark-purple);
  margin-bottom: 1rem;
}

.links-lock-notice i {
  color: var(--primary-purple);
  flex-shrink: 0;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--gray);
}

.header-user strong {
  color: var(--dark-gray);
}

.btn-logout {
  background: none;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  color: var(--gray);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}

/* ═══════════════════════════════════════
   MAIN
═══════════════════════════════════════ */
.main {
  padding: 2rem 0;
}

/* ═══════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  background: var(--white);
  border-radius: 24px;
  box-shadow: 0 24px 64px var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, var(--dark-purple), #8B4513);
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--white);
}

.login-logo {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #FFFFFF, #FFA07A);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-size: 0.95rem;
  opacity: 0.85;
}

.login-body {
  padding: 2rem;
}

.login-body h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--dark-gray);
}

.login-body p {
  font-size: 0.9rem;
  color: var(--gray);
  margin-bottom: 1.5rem;
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-gray);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s;
  background: var(--white);
  color: var(--dark-gray);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.12);
}

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

.field-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 0.4rem;
}

.login-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: none;
}

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-purple), var(--primary-orange));
  color: var(--white);
  width: 100%;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(107, 70, 193, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--light-gray);
  color: var(--dark-gray);
  border: 1px solid #E5E7EB;
}

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

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

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* ═══════════════════════════════════════
   SECTIONS (campaign page)
═══════════════════════════════════════ */
.section-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 8px 32px var(--shadow);
  margin-bottom: 2rem;
  overflow: hidden;
}

.section-header {
  background: linear-gradient(135deg, var(--primary-purple), var(--primary-orange));
  color: var(--white);
  padding: 1.25rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.section-body {
  padding: 1.5rem 1.75rem;
}

/* ═══════════════════════════════════════
   VIDEOS
═══════════════════════════════════════ */
.upload-area {
  border: 2px dashed #D1D5DB;
  border-radius: 14px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--light-gray);
  margin-bottom: 1.5rem;
  position: relative;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary-purple);
  background: rgba(107, 70, 193, 0.05);
}

.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-area i {
  font-size: 2rem;
  color: var(--gray);
  margin-bottom: 0.75rem;
  display: block;
}

.upload-area .upload-text {
  font-size: 0.95rem;
  color: var(--gray);
}

.upload-area .upload-hint {
  font-size: 0.8rem;
  color: #9CA3AF;
  margin-top: 0.25rem;
}

.upload-area .upload-hint.duration-error {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  margin-top: 0.5rem;
  display: inline-block;
}

.upload-area.has-file {
  border-color: var(--primary-purple);
  background: rgba(107, 70, 193, 0.05);
}

.upload-area.has-file .upload-text {
  color: var(--primary-purple);
  font-weight: 600;
}

.upload-area.upload-locked {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: #D1D5DB;
  background: #F9FAFB;
}

.upload-lock-notice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #065F46;
  margin-top: 0.75rem;
}

.upload-lock-notice i {
  color: #10B981;
  flex-shrink: 0;
}

.progress-bar {
  height: 8px;
  background: #E5E7EB;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--primary-purple), var(--primary-orange));
  width: 0%;
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 0.85rem;
  color: var(--gray);
  text-align: center;
}

.videos-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.video-card {
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  gap: 0;
  transition: box-shadow 0.2s;
}

.video-card:hover {
  box-shadow: 0 4px 16px var(--shadow);
}

.video-thumb {
  width: 90px;
  flex-shrink: 0;
  background: var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-size: 1.75rem;
  position: relative;
  overflow: hidden;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.video-details {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rejected-criteria {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #991B1B;
  cursor: pointer;
  user-select: none;
}

.rejected-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem;
}

.rejected-preview i {
  flex-shrink: 0;
}

.criteria-more {
  font-weight: 600;
  text-decoration: underline dotted;
  white-space: nowrap;
}

.rejected-full {
  margin: 0.4rem 0 0 0;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
}

.rejected-full li::before {
  content: '▸ ';
  color: #DC2626;
}

.criteria-section-header {
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6B7280;
  margin-top: 0.5rem;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid #E5E7EB;
  list-style: none;
}

.criteria-section-header:first-child {
  margin-top: 0;
}

.criteria-section-required {
  color: #B91C1C;
}

.criteria-required {
  font-weight: 500;
}

.video-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-date {
  font-size: 0.8rem;
  color: var(--gray);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  width: fit-content;
}

.badge-pending    { background: #F3F4F6; color: var(--gray); }
.badge-validating { background: #FEF3C7; color: #92400E; animation: pulse 2s infinite; }
.badge-approved   { background: #D1FAE5; color: #065F46; }
.badge-rejected   { background: #FEE2E2; color: #991B1B; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* ═══════════════════════════════════════
   LINKS SECTION
═══════════════════════════════════════ */
.links-summary {
  background: var(--light-gray);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--dark-gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.links-summary .count-badge {
  background: linear-gradient(135deg, var(--primary-purple), var(--primary-orange));
  color: var(--white);
  border-radius: 8px;
  padding: 0.3rem 0.75rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.links-summary .count-badge.complete {
  background: var(--success);
}

.links-form {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.links-form .form-input {
  flex: 1;
  min-width: 180px;
}

.links-form select.form-input {
  flex: 0 0 160px;
  min-width: 140px;
  cursor: pointer;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.link-item:hover {
  background: var(--light-gray);
}

.link-network-icon {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.link-url {
  flex: 1;
  color: var(--primary-purple);
  word-break: break-all;
  font-size: 0.85rem;
}

.link-delete {
  background: none;
  border: none;
  color: #D1D5DB;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.link-delete:hover {
  color: var(--danger);
}

/* ═══════════════════════════════════════
   ESTADOS VACÍOS Y LOADING
═══════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--gray);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.95rem;
}

.loading-state {
  text-align: center;
  padding: 2rem;
  color: var(--gray);
  font-size: 0.95rem;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #E5E7EB;
  border-top-color: var(--primary-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--dark-gray);
  color: var(--white);
  padding: 0.875rem 1.25rem;
  border-radius: 12px;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px var(--shadow-lg);
  pointer-events: auto;
  animation: slideIn 0.3s ease;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--dark-gray); }
.toast.info    { background: var(--info); }

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

/* ═══════════════════════════════════════
   UTILITIES
═══════════════════════════════════════ */
.hidden { display: none !important; }

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

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 640px) {
  .login-card { border-radius: 16px; }
  .login-header { padding: 2rem 1.5rem; }
  .login-body { padding: 1.5rem; }

  .links-form { flex-direction: column; }
  .links-form select.form-input { flex: 1; min-width: unset; }

  .section-body { padding: 1rem; }
  .section-header { padding: 1rem; }

  .header-user span { display: none; }
}