/* ====== VARIABLES Y RESET ====== */

:root {
    --primary: #b081c0;
    --primary-dark: #9b5db5;
    --secondary: #6fa598;
    --secondary-dark: #568f84;
    --accent: #FFD93D;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f8f7ff;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #f8f7ff 100%);
    color: var(--text-dark);
    line-height: 1.6;
}

/* ====== HEADER ====== */

.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 10px 30px rgba(176, 129, 192, 0.2);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

.header-text h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header-text p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.btn-reset {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* ====== CONTAINER ====== */

.container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1rem;
}

/* ====== SPREAD SELECTOR ====== */

.spread-selector-section {
    width: 100%;
}

.selector-header {
    text-align: center;
    margin-bottom: 3rem;
}

.selector-header h2 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.selector-header p {
    color: var(--text-light);
    font-size: 1rem;
}

.spreads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.spread-card {
    padding: 1.5rem;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

.spread-card:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 30px rgba(176, 129, 192, 0.15);
    transform: translateY(-5px);
}

.spread-card.active {
    border-color: var(--primary);
    background: rgba(176, 129, 192, 0.1);
    box-shadow: 0 10px 30px rgba(176, 129, 192, 0.25);
}

.spread-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.spread-card h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin: 0;
}

.difficulty-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

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

.difficulty-badge.intermediate {
    background: #fef3c7;
    color: #b45309;
}

.difficulty-badge.advanced {
    background: #e9d5ff;
    color: #6b21a8;
}

.spread-card-description {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.spread-card-info {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ====== SPREAD AREA ====== */

.spread-area {
    animation: fadeIn 0.6s ease-out;
}

.spread-area.hidden {
    display: none;
}

.spread-info {
    text-align: center;
    margin-bottom: 3rem;
}

.spread-info h2 {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.spread-info p {
    color: var(--text-light);
    font-size: 1rem;
}

/* ====== CARDS GRID ====== */

.cards-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 3rem;
    place-items: center;
}

.cards-grid.grid-1 {
    grid-template-columns: 1fr;
}

.cards-grid.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.cards-grid.grid-5 {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.cards-grid.grid-7 {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.cards-grid.grid-10 {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.cards-grid.grid-12 {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.card-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* ====== CARD ====== */

.card {
    width: 120px;
    height: 160px;
    cursor: pointer;
    perspective: 1000px;
    position: relative;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    font-weight: bold;
    font-size: 3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.card-back {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.card-front {
    background: linear-gradient(135deg, var(--bg-white) 0%, #f3f4f6 100%);
    transform: rotateY(180deg);
    padding: 1rem;
    text-align: center;
    flex-direction: column;
    font-size: 0.75rem;
    gap: 0.5rem;
}

.card-front-suit {
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-front-name {
    color: var(--text-dark);
    font-weight: 700;
    font-size: 0.8rem;
    line-height: 1.2;
}

.card-front-meaning {
    color: var(--text-light);
    font-size: 0.65rem;
    line-height: 1.2;
}

.card:hover .card-back {
    transform: scale(1.05);
}

.card-position {
    text-align: center;
    font-size: 0.85rem;
}

.card-position-number {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-position-meaning {
    color: var(--text-dark);
    font-weight: 600;
    margin-top: 0.25rem;
}

.card-hint {
    color: var(--text-light);
    font-size: 0.75rem;
    animation: pulse 2s ease-in-out infinite;
    margin-top: 0.5rem;
}

/* ====== SPREAD CONTROLS ====== */

.spread-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

/* ====== BUTTONS ====== */

.btn-primary,
.btn-secondary {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(176, 129, 192, 0.3);
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(111, 165, 152, 0.3);
}

.btn-secondary:active {
    transform: scale(0.95);
}

/* ====== SHUFFLE OVERLAY ====== */

.shuffle-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.shuffle-overlay.hidden {
    display: none;
}

.shuffle-modal {
    background: white;
    border-radius: 1.5rem;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.4s ease-out;
}

.shuffle-card {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: bounce 1s ease-in-out infinite;
}

.shuffle-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.shuffle-subtext {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.shuffle-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.shuffle-dots span {
    width: 0.5rem;
    height: 0.5rem;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

.shuffle-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.shuffle-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ====== FOOTER ====== */

.footer {
    margin-top: 4rem;
    padding: 2rem;
    background: #1f2937;
    color: #9ca3af;
    text-align: center;
    font-size: 0.9rem;
}

.footer p {
    margin: 0.5rem 0;
}

.footer-disclaimer {
    font-size: 0.8rem;
    color: #6b7280;
}

/* ====== ANIMATIONS ====== */

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* ====== RESPONSIVE ====== */

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .logo {
        font-size: 2.5rem;
    }

    .header-text h1 {
        font-size: 1.5rem;
    }

    .selector-header h2 {
        font-size: 1.5rem;
    }

    .spreads-grid {
        grid-template-columns: 1fr;
    }

    .card {
        width: 100px;
        height: 140px;
    }

    .spread-controls {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .shuffle-modal {
        padding: 2rem;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 1.5rem auto;
    }

    .btn-reset {
        display: none;
    }

    .selector-header h2 {
        font-size: 1.3rem;
    }

    .card {
        width: 90px;
        height: 130px;
    }

    .card-front {
        font-size: 0.65rem;
    }

    .shuffle-modal {
        padding: 1.5rem;
    }
}
