@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@600;700;800&display=swap');

:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.8);
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --font-main: 'Inter', system-ui, sans-serif;
    --font-title: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.logo {
    font-family: var(--font-title);
    letter-spacing: -0.02em;
    color: var(--primary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header & Nav */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    margin-bottom: 40px;
    box-shadow: var(--shadow-sm);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.6rem;
    font-weight: 800;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Grid System */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

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

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-body {
    padding: 24px;
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

/* Forms */
.form-container {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    color: var(--primary);
    background: #fff;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    gap: 10px;
    text-align: center;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg);
    border-color: var(--text-muted);
}

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

.sidebar {
    width: 280px;
    background: var(--primary);
    color: white;
    padding: 40px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 14px 30px;
    color: #94a3b8;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--accent);
}

.main-content {
    flex: 1;
    padding: 40px 60px;
}

/* Tables */
.table-container {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

th {
    background: #f8fafc;
    padding: 16px 24px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Toasts */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
}

.toast {
    background: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.3s ease;
    border-left: 4px solid var(--accent);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utils */
.text-center {
    text-align: center;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

/* ========================================= */
/* ✅ AÑADIDO: Tarjetas compactas en HOME */
/* (no rompe contest_detail ni registration) */
/* ========================================= */

.contest-card{
    max-width: 720px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.3s ease;
}

.contest-card:hover{
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

img.contest-cover{
    width: 100%;
    height: 150px;         /* más pequeño */
    object-fit: cover;     /* ajustado */
    object-position: center;
    display: block;
}
/* Detalle concurso: portada más pequeña y ajustada */
.contest-cover-wrap{
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 30px;
}

.contest-detail-cover{
  width: 100%;
  max-height: 420px;
  height: 420px;
  object-fit: contain;   /* ajustada, sin recortar */
  object-position: center;
  display: block;
  cursor: zoom-in;
  background: #fff;
}

.contest-cover-hint{
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: rgba(15, 23, 42, 0.75);
  color: white;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}

/* Modal imagen */
.cover-modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.cover-modal.open{
  display: flex;
}
.cover-modal-inner{
  background: white;
  border-radius: 16px;
  max-width: 1100px;
  width: 100%;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.cover-modal-close{
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  float: right;
}
.cover-modal-img{
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  display: block;
  border-radius: 12px;
}
/* ============================= */
/* RESPONSIVE CONCURSOS MÓVIL */
/* ============================= */

@media (max-width: 768px) {

    .contest-wrapper {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px;
    }

    .contest-image {
        width: 100% !important;
        margin: 0 auto;
    }

    .contest-sidebar {
        width: 100% !important;
        margin-top: 10px;
    }

    .contest-sidebar .card {
        padding: 20px !important;
    }

    .contest-sidebar h3 {
        font-size: 18px !important;
    }

    .contest-content {
        padding: 0 15px;
    }

}
/* ============================= */
/* RESPONSIVE CONCURSO (MÓVIL)   */
/* ============================= */
@media (max-width: 768px) {

  .contest-wrapper{
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }

  .contest-content{
    padding: 0 15px !important;
  }

  .contest-content img{
    width: 100% !important;
    height: auto !important;
    margin: 0 0 18px 0 !important;
  }

  .contest-sidebar{
    width: 100% !important;
  }

  /* quitar sticky en móvil */
  .contest-sidebar > div{
    position: static !important;
    top: auto !important;
    padding: 20px !important;
  }
}
/* Layout concurso (desktop) */
.contest-wrapper{
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
}

/* Sidebar card reutilizable */
.contest-sidebar-card{
  background: var(--primary);
  color: white;
  padding: 30px;
  border-radius: var(--radius);
  position: sticky;
  top: 20px;
}
/* ========================= */
/* GALERÍA MODAL */
/* ========================= */

.gallery-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
}

.gallery-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    border-radius: 12px;
}

.gallery-close {
    position: absolute;
    top: 25px;
    right: 40px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
}
/* ============================= */
/* GALERÍA LIGHTBOX (MODAL) */
/* ============================= */

.gallery-link {
  display: block;
}

.gallery-link img {
  cursor: zoom-in;
}

/* Modal container */
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

/* Imagen dentro del modal */
.gallery-modal-content {
  max-width: min(90vw, 900px);
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  cursor: pointer;
}
/* Botón cerrar */
.gallery-close {
  position: fixed;
  top: 16px;
  right: 18px;
  font-size: 36px;
  line-height: 36px;
  color: #fff;
  background: rgba(0,0,0,0.35);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

/* Móvil */
@media (max-width: 768px) {
  .gallery-modal {
    padding: 10px;
  }
  .gallery-modal-content {
    max-width: 96vw;
    max-height: 82vh;
    border-radius: 12px;
  }
}
.gallery-modal{
  display:none;
  position:fixed;
  inset:0;
  z-index:9999;
  background: rgba(0,0,0,0.75);
  align-items:center;
  justify-content:center;
  padding: 18px;
}

.gallery-modal-content{
  max-width: min(92vw, 900px);
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.gallery-close{
  position:absolute;
  top: 14px;
  right: 16px;
  font-size: 34px;
  color: #fff;
  cursor:pointer;
  user-select:none;
}