/* AI Tarot Reader - Public Styles */

.ai-tarot-reader-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header */
.tarot-header {
    text-align: center;
    margin-bottom: 40px;
}

.tarot-header h2 {
    font-size: 32px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.tarot-header p {
    font-size: 16px;
    color: #7f8c8d;
}

.reading-info {
    font-weight: 600;
    color: #8e44ad;
}

/* Steps */
.tarot-step {
    min-height: 400px;
}

.tarot-step.hidden {
    display: none;
}

/* Selection Step */
.selection-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.selection-group h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #34495e;
}

.option-grid {
    display: grid;
    gap: 15px;
}

.option-card {
    padding: 20px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.option-card:hover {
    border-color: #8e44ad;
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.1);
    transform: translateY(-2px);
}

.option-card.selected {
    border-color: #8e44ad;
    background: #f8f4fc;
}

.option-card h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #2c3e50;
}

.option-card p {
    margin: 0;
    font-size: 14px;
    color: #7f8c8d;
}

.card-count {
    display: inline-block;
    margin-top: 10px;
    padding: 4px 12px;
    background: #8e44ad;
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Question Input */
.question-container {
    max-width: 700px;
    margin: 30px auto 20px;
    text-align: center;
    display: block !important;
    visibility: visible !important;
}

.question-container h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #34495e;
    font-weight: 600;
}

.question-input {
    width: 100%;
    max-width: 100%;
    padding: 15px;
    font-size: 15px;
    font-family: inherit;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    resize: vertical;
    transition: border-color 0.3s ease;
    background: #fff;
    color: #2c3e50;
    box-sizing: border-box;
    display: block;
}

.question-input:focus {
    outline: none;
    border-color: #8e44ad;
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.1);
}

.question-input::placeholder {
    color: #95a5a6;
    font-style: italic;
}

.character-count {
    text-align: right;
    font-size: 13px;
    color: #7f8c8d;
    margin-top: 5px;
    display: block;
}

.character-count span {
    font-weight: 600;
    color: #8e44ad;
}

/* Actions */
.tarot-actions {
    text-align: center;
    margin-top: 30px;
}

.tarot-button {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 10px;
}

.tarot-button.primary {
    background: #8e44ad;
    color: #fff;
}

.tarot-button.primary:hover:not(:disabled) {
    background: #732d91;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.3);
}

.tarot-button.primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.tarot-button.secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.tarot-button.secondary:hover {
    background: #bdc3c7;
}

.tarot-button .dashicons {
    vertical-align: middle;
    margin-right: 5px;
}

/* Drawing Animation */
.drawing-animation {
    text-align: center;
    padding: 80px 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 30px;
    border: 4px solid #ecf0f1;
    border-top-color: #8e44ad;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.drawing-message {
    font-size: 18px;
    color: #7f8c8d;
    font-style: italic;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Cards Display */
.cards-display-wrapper {
    margin-bottom: 40px;
}

.spread-title {
    text-align: center;
    font-size: 22px;
    color: #2c3e50;
    margin-bottom: 20px;
    font-weight: 600;
}

.cards-display {
    position: relative;
    min-height: 500px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 80px 40px 60px 40px;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Single Card Layout */
.cards-display.layout-single {
    min-height: 400px;
    padding: 60px 40px;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.cards-display.layout-single .tarot-card {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    margin: 0;
}

/* Three Card Layout */
.cards-display.layout-horizontal {
    gap: 30px;
    min-height: 450px;
    flex-wrap: nowrap;
    padding: 60px 40px;
}

.cards-display.layout-horizontal .tarot-card {
    position: static;
    transform: none !important;
    flex-shrink: 0;
}

/* Celtic Cross Layout */
.cards-display.layout-celtic-cross {
    min-height: 750px;
    padding: 100px 80px 80px 80px;
    display: block;
}

/* Grid Layout */
.cards-display.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    min-height: 500px;
    padding: 60px 40px;
}

.cards-display.layout-grid .tarot-card {
    position: static;
    transform: none !important;
}

/* Card Sizing */
.tarot-card {
    position: absolute;
    width: 140px;
    height: 220px;
    opacity: 0;
    transition: all 0.5s ease;
}

.tarot-card.show {
    opacity: 1;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    background: #fff;
    cursor: pointer;
    transition: transform 0.3s ease, z-index 0s;
}

.card-inner:hover {
    transform: scale(1.05) !important;
    z-index: 1000 !important;
}

.tarot-card:hover {
    z-index: 1000 !important;
}

.card-image {
    width: 100%;
    height: 100%;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

/* Reversed cards - rotate the image, not the overlay */
.tarot-card.reversed .card-image {
    transform: rotate(180deg);
}

/* Card Info Overlay - Full card coverage with better readability */
.card-info-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    padding: 20px 15px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform-origin: center center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 8px;
}

/* For cards rotated 90 degrees, swap width/height for the overlay */
.tarot-card[data-rotation="90"] .card-info-overlay,
.tarot-card[data-rotation="-90"] .card-info-overlay {
    width: 220px;
    height: 140px;
    left: 50%;
    top: 50%;
    margin-left: -110px;
    margin-top: -70px;
}

.card-inner:hover .card-info-overlay {
    opacity: 1;
}

.card-info-overlay h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    text-transform: uppercase;
    color: #a78bfa;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.card-info-overlay .card-name {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.card-info-overlay .card-orientation {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-style: italic;
    color: #d1d5db;
}

.card-info-overlay .card-keywords {
    margin: 0;
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.4;
}

/* Interpretation */
.interpretation-section {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.interpretation-section h3 {
    margin-top: 0;
    font-size: 24px;
    color: #2c3e50;
    border-bottom: 2px solid #8e44ad;
    padding-bottom: 10px;
}

.interpretation-text {
    font-size: 16px;
    line-height: 1.8;
    color: #34495e;
}

.interpretation-text p {
    margin-bottom: 15px;
}

/* Error Message */
.tarot-error {
    background: #e74c3c;
    color: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.tarot-error.hidden {
    display: none;
}

.error-content {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.error-content .dashicons {
    font-size: 24px;
    margin-right: 10px;
}

.error-content p {
    margin: 0;
    font-size: 16px;
}

/* Dark Theme */
.ai-tarot-reader-container[data-theme="dark"] {
    background: #1a1a2e;
    color: #eee;
}

.ai-tarot-reader-container[data-theme="dark"] .tarot-header h2,
.ai-tarot-reader-container[data-theme="dark"] .selection-group h3 {
    color: #eee;
}

.ai-tarot-reader-container[data-theme="dark"] .option-card {
    background: #16213e;
    border-color: #0f3460;
    color: #eee;
}

.ai-tarot-reader-container[data-theme="dark"] .option-card.selected {
    background: #8e44ad;
    border-color: #732d91;
}

.ai-tarot-reader-container[data-theme="dark"] .interpretation-section {
    background: #16213e;
    color: #eee;
}

/* Responsive */
@media (max-width: 768px) {
    .selection-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .question-container {
        max-width: 100%;
        padding: 0 10px;
    }
    
    .question-input {
        font-size: 14px;
        padding: 12px;
    }
    
    .cards-display {
        padding: 40px 20px 20px 20px;
        min-height: 400px;
    }
    
    .cards-display.layout-celtic-cross {
        min-height: 600px;
        padding: 60px 30px 40px 30px;
    }
    
    .tarot-card {
        width: 110px;
        height: 173px;
    }
    
    .cards-display.layout-horizontal {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .tarot-button {
        padding: 12px 24px;
        font-size: 14px;
        margin: 5px;
    }
    
    .card-info-overlay {
        padding: 15px 10px;
    }
    
    .card-info-overlay h4 {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .card-info-overlay .card-name {
        font-size: 14px;
    }
    
    .card-info-overlay .card-orientation {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .card-info-overlay .card-keywords {
        font-size: 10px;
    }
}