/* Variables de color */
:root {
    --primary: #ff6b00;
    --primary-dark: #e05a00;
    --secondary: #1683ba;
    --dark: #1e2a3a;
    --light: #f8f9fa;
    --gray: #6c757d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Poppins', sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo h1 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.btn-admin {
    background: var(--primary);
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: 50px;
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    text-align: center;
    padding: 4rem 0;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.btn-primary {
    background: white;
    color: var(--primary);
    padding: 0.8rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s;
    display: inline-block;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

/* Rifas Grid */
.rifas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.rifa-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    border-top: 5px solid var(--primary);
}

.rifa-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.rifa-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.rifa-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.rifa-content {
    padding: 1.5rem;
}

.rifa-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.rifa-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    margin: 1rem 0;
}

.progress-bar {
    background: #e9ecef;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    background: var(--primary);
    height: 100%;
    width: 0%;
    transition: width 0.3s;
}

/* Botones de acción en tarjetas */
.btn-comprar {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem;
    width: 100%;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 1rem;
}

.btn-comprar:hover {
    background: var(--primary-dark);
}

.btn-maquina {
    background: #28a745;   /* Verde */
    color: white;
    border: none;
    padding: 0.8rem;
    width: 100%;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 0.5rem;
}

.btn-maquina:hover {
    background: #218838;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    width: 700px;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
}

.close:hover {
    color: var(--primary);
}

.numeros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    margin: 1rem 0;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 15px;
}

.numero-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.numero-item.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.numero-item.vendido {
    background: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    text-decoration: line-through;
}

.resumen {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 15px;
    margin: 1rem 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-family: inherit;
}

/* Footer */
.footer {
    background: var(--dark);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Admin styles */
.admin-header {
    background: var(--dark);
    color: white;
    padding: 1rem 0;
}

.admin-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 1.5rem;
}

.admin-header .btn-logout {
    background: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    color: white;
    text-decoration: none;
}

.admin-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 20px;
}

.rifa-item {
    background: white;
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.rifa-actions button {
    margin-left: 0.5rem;
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.btn-edit {
    background: var(--secondary);
    color: white;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-create {
    background: #28a745;
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 1rem;
}

/* Formulario admin */
.rifa-form {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    max-width: 600px;
    margin: 2rem auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.rifa-form input,
.rifa-form textarea {
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.rifa-form button {
    background: var(--primary);
    color: white;
    padding: 0.8rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
}

.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.login-container input {
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.login-container button {
    width: 100%;
    padding: 0.8rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    .hero h1 {
        font-size: 1.8rem;
    }
}