/**
 * Relationship Tarot Spread CSS
 * 
 * Styles for the 7-card relationship tarot spread.
 * 
 * @since 1.0.0
 */

/* Main container */
.relationship-tarot-container {
    font-family: 'Arial', sans-serif;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    background-color: #f8f4ee;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header section */
.relationship-tarot-header {
    margin-bottom: 30px;
}

.relationship-tarot-title {
    font-size: 24px;
    color: #3e2a5a;
    margin-bottom: 10px;
}

.relationship-tarot-desc {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Card deck section */
.tarot-deck-container {
    position: relative;
    height: 200px;
    margin-bottom: 40px;
    perspective: 1000px;
}

.tarot-deck {
    position: relative;
    width: 140px;
    height: 200px;
    margin: 0 auto;
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
    cursor: pointer;
}

.tarot-deck:hover {
    transform: translateY(-10px);
}

.tarot-deck::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #3e2a5a;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    transform: translateZ(1px);
}

.tarot-deck::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    background-image: url('../images/card-back.svg');
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    transform: translateZ(2px);
}

.tarot-deck-label {
    position: absolute;
    bottom: -30px;
    left: 0;
    right: 0;
    text-align: center;
    color: #3e2a5a;
    font-weight: bold;
}

/* Spread and selection area */
.tarot-selection-area {
    display: none;
    margin-top: 20px;
    margin-bottom: 40px;
    padding: 20px;
    background-color: rgba(62, 42, 90, 0.05);
    border-radius: 10px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    scrollbar-color: #6a4c93 #f0e6ff;
    position: relative;
}

.tarot-selection-area::-webkit-scrollbar {
    height: 8px;
}

.tarot-selection-area::-webkit-scrollbar-track {
    background: #f0e6ff;
    border-radius: 10px;
}

.tarot-selection-area::-webkit-scrollbar-thumb {
    background-color: #6a4c93;
    border-radius: 10px;
}

.tarot-selection-label {
    display: block;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
    color: #3e2a5a;
}

.tarot-card-selection {
    display: inline-flex;
    justify-content: flex-start;
    padding: 10px 0;
    min-width: 100%;
    position: relative;
    height: 200px; /* Fixed height to accommodate overlapping cards */
}

/* Individual selectable card */
.selectable-card {
    position: absolute;
    width: 100px;
    height: 150px;
    background-image: url('../images/card-back.svg');
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-left: -65px; /* Create overlapping effect */
}

.selectable-card:hover {
    transform: translateY(-20px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    z-index: 10; /* Bring hovered card to front */
}

.selectable-card.selected {
    border: 3px solid #ffcc00;
    transform: translateY(-25px);
    z-index: 5; /* Bring selected cards above others but below hovered */
}

.selectable-card.selected::after {
    content: '✓';
    position: absolute;
    top: -15px;
    right: -10px;
    width: 25px;
    height: 25px;
    background: #ffcc00;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3e2a5a;
    font-weight: bold;
    border: 2px solid white;
}

/* Reading spread layout */
.tarot-reading-spread {
    display: none;
    margin-top: 30px;
    position: relative;
}

.tarot-reading-spread.visible {
    display: block;
}

/* Relationship diagram */
.relationship-diagram {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 40px;
    gap: 10px;
}

.diagram-card-container {
    position: relative;
    width: calc(33.33% - 20px);
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.diagram-card {
    width: 140px;
    height: 200px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s;
    cursor: pointer;
}

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

.diagram-card-front, .diagram-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.diagram-card-back {
    background-color: #F8F4E3;
    background-image: url('../images/card-back.svg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid #D3D0C2;
}

.diagram-card-front {
    background-color: white;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    border: 1px solid #eaeaea;
}

.diagram-card-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    max-height: 80%;
}

.diagram-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.diagram-card-name {
    padding: 8px 5px;
    background-color: #3e2a5a;
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
}

.diagram-card-label {
    margin-top: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #3e2a5a;
    text-align: center;
}

.reversed-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(193, 60, 108, 0.8);
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    z-index: 1;
}

/* Center card (relationship) */
.center-card {
    margin: 20px auto;
    max-width: 160px;
}

/* Special positioning for mobile */
@media (max-width: 768px) {
    .relationship-diagram {
        flex-direction: column;
        align-items: center;
    }
    
    .diagram-card-container {
        width: 100%;
        max-width: 160px;
        margin-bottom: 30px;
    }
}

/* Interpretation section */
.reading-interpretation {
    display: none;
    margin-top: 40px;
    padding: 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: left;
}

.reading-interpretation.visible {
    display: block;
}

.reading-title {
    font-size: 20px;
    color: #3e2a5a;
    margin-bottom: 20px;
    text-align: center;
}

.card-interpretation {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.card-interpretation:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.card-interpretation h3 {
    font-size: 18px;
    color: #3e2a5a;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.card-interpretation h3 span {
    font-weight: normal;
    font-size: 14px;
    color: #c13c6c;
    margin-left: 10px;
}

.card-interpretation p {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
}

/* Buttons */
.tarot-button {
    background-color: #6a4c93;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin: 20px 10px;
}

.tarot-button:hover {
    background-color: #593d80;
}

.tarot-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.tarot-reset-button {
    background-color: transparent;
    color: #6a4c93;
    border: 1px solid #6a4c93;
    border-radius: 5px;
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px 10px;
}

.tarot-reset-button:hover {
    background-color: #f0e6ff;
}

.tarot-button-container {
    margin-top: 20px;
}

/* Card selection counter */
.selection-counter {
    display: inline-block;
    margin: 10px 0;
    font-size: 14px;
    font-weight: bold;
    color: #3e2a5a;
}

/* Animation for shuffling */
@keyframes shuffle {
    0% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-5px) rotate(-2deg); }
    50% { transform: translateX(5px) rotate(2deg); }
    75% { transform: translateX(-5px) rotate(-1deg); }
    100% { transform: translateX(0) rotate(0); }
}

.shuffling {
    animation: shuffle 0.5s ease-in-out 3;
}

/* Card spreading animation */
@keyframes spread-card {
    from { 
        transform: translateX(0);
        opacity: 0;
    }
    to { 
        transform: translateX(var(--spread-distance));
        opacity: 1;
    }
}

.spreading {
    animation: spread-card 0.5s forwards;
}

/* Flip animation */
@keyframes flip-card {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(180deg); }
}

.flipping {
    animation: flip-card 0.8s forwards;
}

/* Loading state */
.loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.loading-overlay.visible {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(62, 42, 90, 0.3);
    border-radius: 50%;
    border-top-color: #3e2a5a;
    animation: spin 1s ease-in-out infinite;
}

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