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

:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Navegación */
.navbar {
    background-color: var(--surface);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

/* Main content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Hero section */
.hero {
    text-align: center;
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #65408b 100%);
}

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

.btn-secondary:hover {
    background-color: #475569;
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

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

.btn-warning:hover {
    background-color: #d97706;
}

.btn-info {
    background-color: #0ea5e9;
    color: white;
}

.btn-info:hover {
    background-color: #0284c7;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid var(--success-color);
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid var(--error-color);
}

/* Cards de rifas */
.rifas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.rifa-card {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
}

.rifa-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.rifa-imagen {
    width: 100%;
    height: 200px;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.rifa-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.rifa-card:hover .rifa-imagen img {
    transform: scale(1.05);
}

.rifa-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.premio {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.5rem 0;
}

.descripcion {
    color: var(--text-secondary);
    margin: 0.5rem 0 1rem;
}

.rifa-info {
    margin: 1rem 0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item .label {
    color: var(--text-secondary);
}

.info-item .value {
    font-weight: 600;
}

/* Progress bar */
.progress-bar {
    background-color: var(--border-color);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0 0.5rem;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    height: 100%;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.card-actions .btn {
    flex: 1;
    /* Usar flexbox para centrar el contenido del botón vertical y horizontalmente */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* Asegurar altura mínima uniforme para mejor apariencia */
    min-height: 44px;
    padding: 0.5rem 1rem;
}

/* Formularios */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-container h1 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Detalles de rifa */
.rifa-details {
    background-color: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

/* Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.stat-card {
    background-color: var(--background);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border: 2px solid var(--border-color);
}

.stat-card.success {
    border-color: var(--success-color);
}

.stat-card.reserved {
    border-color: #f59e0b;
}

.stat-card.warning {
    border-color: var(--warning-color);
}

.stat-card.info {
    border-color: var(--primary-color);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Gestión de boletas */
.gestionar-boletas {
    background-color: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.header-stats {
    display: flex;
    gap: 2rem;
}

.header-stats .stat {
    font-size: 1.1rem;
}

.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background-color: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: var(--primary-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.boletas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.boleta-card {
    background-color: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s;
}

.boleta-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.boleta-numero {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.boleta-estado {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 0.5rem 0;
}

.estado-disponible {
    background-color: #d1fae5;
    color: #065f46;
}

.estado-vendida {
    background-color: #fee2e2;
    color: #991b1b;
}

.estado-reservada {
    background-color: #fef3c7;
    color: #92400e;
}

.boleta-comprador {
    margin: 0.5rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.boleta-comprador small {
    display: block;
}

.boleta-actions {
    margin-top: 0.5rem;
}

/* Botón flotante para volver al inicio */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease-in-out;
    z-index: 1000;
}

.scroll-to-top:hover {
    transform: translateY(0) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-activa {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-finalizada {
    background-color: #e2e8f0;
    color: #475569;
}

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

.badge-disponible {
    background-color: #d1fae5;
    color: #065f46;
}

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

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

/* Tablas */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    background-color: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

thead {
    background-color: var(--primary-color);
    color: white;
}

th, td {
    padding: 1rem;
    text-align: left;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background-color: var(--background);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

/* Actions section */
.actions-section {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Lista de boletas del comprador */
.boletas-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.boleta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

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

.boleta-info .fecha {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Precio destacado */
.precio-destacado {
    font-size: 1.5rem;
    color: var(--success-color);
    font-weight: bold;
    text-align: center;
    margin: 1rem 0;
}

/* Footer */
footer {
    background-color: var(--surface);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
    color: var(--text-secondary);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .rifas-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .boletas-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
        word-break: break-word;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
    
    /* Botones de acciones en móvil */
    .actions-section {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .actions-section .btn {
        width: 100%;
        text-align: center;
    }
    
    .actions-section button {
        width: 100%;
    }
}
