/* IChing CSS Styles */
/* iching.css - Additional styles for iChing pages */

/* Method cards with consistent heights */
.method-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.method-card > div.flex,
.method-card > div {
    flex: 1;
}

.method-card p {
    margin-bottom: 0;
    min-height: 3em;
}

.method-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.method-card.coin-toss:hover {
    border-color: #fbbf24;
}

.method-card.meihua:hover {
    border-color: #ec4899;
}

.method-card.liuyao:hover {
    border-color: #3b82f6;
}

/* Centered icon and title layout */
.method-card .flex.items-center.justify-center {
    display: flex;
    justify-content: center;
}

/* Hexagram grid styling */
.hexagram-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 1.5rem;
    margin: 2.5rem 0;
}

.hexagram-item {
    background: linear-gradient(135deg, #f0f7ff 0%, #e0e7ef 100%);
    border-radius: 1rem;
    padding: 1.5rem 1rem 1.25rem 1rem;
    text-align: center;
    box-shadow: 0 4px 16px rgba(59,130,246,0.08), 0 1.5px 6px rgba(0,0,0,0.04);
    transition: box-shadow 0.25s cubic-bezier(.4,2,.6,1), border-color 0.2s, background 0.3s, transform 0.18s cubic-bezier(.4,2,.6,1);
    cursor: pointer;
    min-height: 170px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border: 2px solid #e0e7ef;
    position: relative;
}

.hexagram-item:hover {
    transform: translateY(-8px) scale(1.04);
    box-shadow: 0 8px 32px rgba(59,130,246,0.18), 0 1.5px 6px rgba(0,0,0,0.10);
    border-color: #3b82f6;
    background: linear-gradient(135deg, #e0e7ef 0%, #f0f7ff 100%);
}

.hexagram-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2563eb;
    margin-bottom: 0.5rem;
    background: #e0e7ef;
    border-radius: 50%;
    width: 2.2em;
    height: 2.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 2px 8px rgba(59,130,246,0.08);
    border: 2px solid #c7d2fe;
}

.hexagram-chinese {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.15rem;
}

.hexagram-name {
    font-size: 0.95rem;
    color: #374151;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.hexagram-meaning {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
    margin-top: 0.5em;
    min-height: 2.2em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hexagram display */
.hexagram-display {
    font-family: 'Times New Roman', serif;
    text-align: center;
    margin: 1rem 0;
}

.hexagram-lines {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0 auto 8px auto;
    width: 100px;
}

.hexagram-line {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
}

/* Original hexagram line style */
.line-segment {
    width: 2rem;
    height: 0.5rem;
    background-color: #374151;
    border-radius: 2px;
}

.line-segment.broken {
    display: flex;
    gap: 0.25rem;
}

.line-segment.broken::before,
.line-segment.broken::after {
    content: '';
    width: 0.75rem;
    height: 0.5rem;
    background-color: #374151;
    border-radius: 2px;
}

/* Modern hexagram line style */
.hexagram-line.yang {
    width: 80px;
    height: 10px;
    background: #111;
    border-radius: 4px;
}

.hexagram-line.yin {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 10px;
}

.hexagram-line.yin .yin-segment {
    width: 34px;
    height: 10px;
    background: #111;
    border-radius: 4px;
}

.hexagram-line.yin .yin-gap {
    width: 12px;
    height: 10px;
    background: transparent;
}

/* Changing lines highlight */
.changing-line {
    background-color: #fbbf24 !important;
    box-shadow: 0 0 0 2px #f59e0b;
}

.changing-line::before,
.changing-line::after {
    background-color: #fbbf24 !important;
}

/* Result animations */
.result-fade-in {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Coin toss animation */
.coin-toss-animation {
    animation: coinFlip 0.6s ease-in-out;
}

@keyframes coinFlip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

/* Form styling */
.divination-form {
    background: white;
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.divination-form textarea {
    resize: vertical;
    min-height: 100px;
}

/* Result styling */
.divination-result {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 0.75rem;
    padding: 2rem;
    margin: 2rem 0;
}

.hexagram-info {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1rem 0;
    border-left: 4px solid #3b82f6;
}

.changed-hexagram-info {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.changing-lines-info {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left-color: #f59e0b;
}

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Button states */
.btn-divination {
    position: relative;
    overflow: hidden;
}

.btn-divination:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-divination .loading-text {
    display: none;
}

.btn-divination:disabled .loading-text {
    display: inline;
}

.btn-divination:disabled .normal-text {
    display: none;
}

/* Special effects for changing lines */
.changing-line-indicator {
    position: relative;
}

.changing-line-indicator::after {
    content: '↔';
    position: absolute;
    right: -1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #f59e0b;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Hexagram flex layout */
.hexagram-row {
    display: flex;
    gap: 32px;
    justify-content: center;
    align-items: stretch;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.hexagram-col {
    flex: 1 1 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px 0 18px 0;
    margin: 0 8px;
    min-width: 180px;
    max-width: 240px;
    text-align: center;
    min-height: 260px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.hexagram-col:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    border-color: #b2dfdb;
}

.hexagram-col table {
    margin: 0 auto 8px auto;
    width: 100%;
    max-width: 110px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #f0f0f0;
}

.hexagram-col div[style*="width:80px"] {
    margin: 0 auto;
}

/* 64 Hexagrams Grid Styling */
#hexagrams-container .hexagram-item {
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ef 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 1.5rem 1rem 1.25rem 1rem;
    transition: 
        box-shadow 0.25s cubic-bezier(.4,2,.6,1),
        border-color 0.2s,
        background 0.3s,
        transform 0.18s cubic-bezier(.4,2,.6,1);
    cursor: pointer;
    min-height: 170px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

#hexagrams-container .hexagram-item:hover {
    transform: translateY(-8px) scale(1.04);
    box-shadow: 0 8px 24px rgba(59,130,246,0.18), 0 1.5px 6px rgba(0,0,0,0.08);
    border-color: #3b82f6;
    background: linear-gradient(135deg, #e0e7ef 0%, #f0f7ff 100%);
}

#hexagrams-container .hexagram-item:hover .hexagram-number {
    color: #2563eb;
    text-shadow: 0 1px 4px #dbeafe;
}

#hexagrams-container .hexagram-item:hover .hexagram-chinese {
    color: #1e40af;
}

#hexagrams-container .hexagram-item:hover .hexagram-name {
    color: #3b82f6;
}

#hexagrams-container .hexagram-item:hover .hexagram-meaning {
    color: #6b7280;
}

#hexagrams-container .hexagram-item:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, #3b82f6, #60a5fa);
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .hexagram-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1rem;
    }
}
@media (max-width: 640px) {
    .hexagram-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }
    .hexagram-item {
        padding: 1rem 0.5rem;
    }
}