/* ========================================
   Thisgun Gunghap - 궁합 운세 스타일
   Version 1.0.0
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@400;700;900&display=swap');

#thisgun-gunghap-app {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Noto Serif KR', serif;
    color: #5a4a3a;
}

/* Section base */
.gunghap-section {
    background: linear-gradient(135deg, #fff5f7, #fff0f3);
    border: 2px solid #e8a0b0;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(192,57,43,0.08);
}

.gunghap-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(circle at 10% 10%, rgba(255,182,193,0.15) 0%, transparent 50%),
        radial-gradient(circle at 90% 90%, rgba(192,57,43,0.05) 0%, transparent 50%);
    pointer-events: none;
}

/* Header */
.gunghap-header {
    text-align: center;
    margin-bottom: 30px;
}

.gunghap-header h2 {
    font-size: 2.5em;
    color: #C0392B;
    margin: 0 0 5px;
    text-shadow: 0 0 20px rgba(192,57,43,0.15);
    letter-spacing: 0.3em;
}

.gunghap-header h3 {
    font-size: 1.4em;
    color: #5a4a3a;
    margin: 0 0 10px;
    font-weight: 400;
}

.gunghap-subtitle {
    color: #a08878;
    font-size: 0.95em;
    margin: 0;
}

/* Form Layout */
.gunghap-form-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 20px;
}

.gunghap-person-col {
    flex: 1;
    background: rgba(255,255,255,0.7);
    border: 1px solid #e8a0b0;
    border-radius: 12px;
    padding: 20px;
}

.gunghap-person-label {
    text-align: center;
    font-size: 1.2em;
    font-weight: 700;
    color: #C0392B;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(192,57,43,0.15);
}

.gunghap-vs-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    gap: 5px;
}

.gunghap-vs-heart {
    font-size: 2em;
    color: #C0392B;
    animation: heartPulse 1.5s ease-in-out infinite;
}

.gunghap-vs-text {
    font-size: 1.2em;
    font-weight: 900;
    color: #C0392B;
    letter-spacing: 0.1em;
}

@keyframes heartPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Form Groups */
.gunghap-form-group {
    margin-bottom: 15px;
}

.gunghap-form-group label {
    display: block;
    color: #C0392B;
    font-size: 0.9em;
    margin-bottom: 6px;
    font-weight: 700;
}

.gunghap-form-group input[type="text"],
.gunghap-form-group select {
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e8a0b0;
    border-radius: 8px;
    color: #5a4a3a;
    font-size: 0.95em;
    font-family: 'Noto Serif KR', serif;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.gunghap-form-group input[type="text"]:focus,
.gunghap-form-group select:focus {
    outline: none;
    border-color: #C0392B;
    box-shadow: 0 0 8px rgba(192,57,43,0.15);
}

.gunghap-date-selectors {
    display: flex;
    gap: 6px;
}

.gunghap-date-selectors select {
    flex: 1;
}

/* Gender */
.gunghap-gender-group {
    display: flex;
    gap: 10px;
}

.gunghap-radio-label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e8a0b0;
    border-radius: 8px;
    flex: 1;
    justify-content: center;
    transition: all 0.3s;
    color: #5a4a3a !important;
    font-weight: 400 !important;
    margin-bottom: 0 !important;
    font-size: 0.9em;
}

.gunghap-radio-label:has(input:checked) {
    background: rgba(192,57,43,0.1);
    border-color: #C0392B;
    box-shadow: 0 0 8px rgba(192,57,43,0.15);
}

.gunghap-radio-label input[type="radio"] {
    accent-color: #C0392B;
}

/* Submit Button */
.gunghap-submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #C0392B, #e74c3c);
    color: #fff;
    border: 2px solid #C0392B;
    border-radius: 12px;
    font-size: 1.3em;
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.15em;
    margin-top: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.gunghap-submit-btn:hover {
    background: linear-gradient(135deg, #a93226, #c0392b);
    box-shadow: 0 4px 20px rgba(192,57,43,0.3);
    transform: translateY(-2px);
}

.gunghap-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading */
.gunghap-loading {
    text-align: center;
    padding: 40px;
}

.gunghap-loading-hearts {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.gunghap-heart-bounce {
    font-size: 2em;
    color: #C0392B;
    animation: heartBounce 1s ease-in-out infinite;
}

.gunghap-heart-bounce.delay1 { animation-delay: 0.2s; }
.gunghap-heart-bounce.delay2 { animation-delay: 0.4s; }

@keyframes heartBounce {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(-15px); opacity: 1; }
}

.gunghap-loading p {
    color: #C0392B;
    font-size: 1.1em;
}

/* ========================================
   Score Gauge
   ======================================== */

.gunghap-score-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 0;
}

.gunghap-score-gauge {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
}

.gunghap-score-gauge svg {
    transform: rotate(-90deg);
}

.gunghap-score-circle-bg {
    fill: none;
    stroke: #f0d0d5;
    stroke-width: 12;
}

.gunghap-score-circle-fg {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 2s ease-out;
}

.gunghap-score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gunghap-score-number {
    font-size: 3em;
    font-weight: 900;
    line-height: 1;
}

.gunghap-score-unit {
    font-size: 0.9em;
    color: #a08878;
}

.gunghap-score-grade {
    font-size: 1.8em;
    font-weight: 900;
    margin-top: 10px;
}

.gunghap-score-label {
    font-size: 1.3em;
    font-weight: 700;
    margin-top: 5px;
}

.gunghap-score-names {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 15px;
    color: #C0392B;
}

/* Score colors */
.score-s { color: #DAA520; }
.score-a { color: #27ae60; }
.score-b { color: #2980b9; }
.score-c { color: #f39c12; }
.score-d { color: #e67e22; }
.score-f { color: #C0392B; }

/* ========================================
   Result Cards
   ======================================== */

.gunghap-result-card {
    background: rgba(255,255,255,0.8);
    border: 1px solid rgba(232,160,176,0.4);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    animation: gunghapFadeIn 0.5s ease forwards;
}

.gunghap-result-card:nth-child(2) { animation-delay: 0.1s; }
.gunghap-result-card:nth-child(3) { animation-delay: 0.2s; }
.gunghap-result-card:nth-child(4) { animation-delay: 0.3s; }
.gunghap-result-card:nth-child(5) { animation-delay: 0.4s; }
.gunghap-result-card:nth-child(6) { animation-delay: 0.5s; }
.gunghap-result-card:nth-child(7) { animation-delay: 0.6s; }
.gunghap-result-card:nth-child(8) { animation-delay: 0.7s; }
.gunghap-result-card:nth-child(9) { animation-delay: 0.8s; }

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

.gunghap-result-card h3 {
    color: #C0392B;
    font-size: 1.3em;
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(192,57,43,0.15);
}

.gunghap-result-card p {
    line-height: 1.8;
    margin: 10px 0;
    color: #5a4a3a;
}

/* Four Pillars Comparison */
.gunghap-pillars-compare {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.gunghap-pillars-side {
    flex: 1;
}

.gunghap-pillars-side h4 {
    text-align: center;
    color: #C0392B;
    margin: 0 0 10px;
    font-size: 1.1em;
}

.gunghap-pillars-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 4px;
    table-layout: fixed;
}

.gunghap-pillars-table th {
    background: linear-gradient(135deg, #C0392B, #e74c3c);
    color: #fff;
    padding: 8px 4px;
    border-radius: 6px 6px 0 0;
    font-size: 0.85em;
    letter-spacing: 0.05em;
}

.gunghap-pillar-cell {
    background: #fff;
    border: 1px solid #e8a0b0;
    padding: 10px 5px;
    text-align: center;
    vertical-align: middle;
}

.gunghap-stem-cell {
    border-radius: 0;
    font-size: 1.4em;
    font-weight: 700;
}

.gunghap-branch-cell {
    border-radius: 0 0 6px 6px;
    font-size: 1.4em;
    font-weight: 700;
}

.gunghap-char-hanja {
    display: block;
    font-size: 1em;
}

.gunghap-char-hangul {
    display: block;
    font-size: 0.5em;
    color: #a08878;
    margin-top: 2px;
}

.gunghap-element-label {
    display: inline-block;
    font-size: 0.35em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 3px;
    font-weight: 400;
}

/* Element colors */
.elem-wood { color: #27ae60; }
.elem-fire { color: #e74c3c; }
.elem-earth { color: #f39c12; }
.elem-metal { color: #95a5a6; }
.elem-water { color: #2980b9; }

.elem-bg-wood { background: rgba(39,174,96,0.15); color: #27ae60; }
.elem-bg-fire { background: rgba(231,76,60,0.15); color: #e74c3c; }
.elem-bg-earth { background: rgba(243,156,18,0.15); color: #f39c12; }
.elem-bg-metal { background: rgba(149,165,166,0.15); color: #7f8c8d; }
.elem-bg-water { background: rgba(41,128,185,0.15); color: #2980b9; }

/* Zodiac Display */
.gunghap-zodiac-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.gunghap-zodiac-animal {
    text-align: center;
}

.gunghap-zodiac-emoji {
    font-size: 3em;
    display: block;
}

.gunghap-zodiac-name {
    font-size: 1em;
    font-weight: 700;
    color: #5a4a3a;
    margin-top: 5px;
}

.gunghap-zodiac-vs {
    font-size: 1.5em;
    color: #C0392B;
    font-weight: 900;
}

.gunghap-zodiac-result {
    text-align: center;
    margin-top: 15px;
}

.gunghap-zodiac-type {
    font-size: 1.2em;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 10px;
}

.type-best { background: linear-gradient(135deg, #DAA520, #f4d03f); color: #5a3a00; }
.type-good { background: linear-gradient(135deg, #27ae60, #2ecc71); color: #fff; }
.type-normal { background: linear-gradient(135deg, #2980b9, #3498db); color: #fff; }
.type-caution { background: linear-gradient(135deg, #e67e22, #f39c12); color: #fff; }
.type-bad { background: linear-gradient(135deg, #c0392b, #e74c3c); color: #fff; }

/* Five Elements Comparison */
.gunghap-elements-compare {
    display: flex;
    gap: 30px;
    margin: 20px 0;
}

.gunghap-elements-side {
    flex: 1;
}

.gunghap-elements-side h4 {
    text-align: center;
    color: #C0392B;
    margin: 0 0 10px;
    font-size: 1em;
}

.gunghap-element-bar-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.gunghap-element-bar-label {
    width: 30px;
    font-size: 0.9em;
    font-weight: 700;
    text-align: center;
}

.gunghap-element-bar-track {
    flex: 1;
    height: 20px;
    background: #f5e0e3;
    border-radius: 10px;
    overflow: hidden;
}

.gunghap-element-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-out;
    min-width: 0;
}

.gunghap-element-bar-fill.wood { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.gunghap-element-bar-fill.fire { background: linear-gradient(90deg, #c0392b, #e74c3c); }
.gunghap-element-bar-fill.earth { background: linear-gradient(90deg, #e67e22, #f39c12); }
.gunghap-element-bar-fill.metal { background: linear-gradient(90deg, #7f8c8d, #bdc3c7); }
.gunghap-element-bar-fill.water { background: linear-gradient(90deg, #2980b9, #3498db); }

.gunghap-element-bar-count {
    width: 20px;
    font-size: 0.85em;
    font-weight: 700;
    text-align: center;
}

/* Sub-score bar */
.gunghap-subscore {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.gunghap-subscore-label {
    width: 80px;
    font-size: 0.9em;
    font-weight: 700;
    color: #C0392B;
    text-align: right;
}

.gunghap-subscore-track {
    flex: 1;
    height: 14px;
    background: #f5e0e3;
    border-radius: 7px;
    overflow: hidden;
}

.gunghap-subscore-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 1.5s ease-out;
    background: linear-gradient(90deg, #C0392B, #e74c3c);
}

.gunghap-subscore-value {
    width: 45px;
    font-size: 0.9em;
    font-weight: 700;
    color: #5a4a3a;
}

/* Love Style */
.gunghap-love-compare {
    display: flex;
    gap: 20px;
}

.gunghap-love-side {
    flex: 1;
    background: rgba(255,228,232,0.5);
    border: 1px solid rgba(232,160,176,0.3);
    border-radius: 10px;
    padding: 15px;
}

.gunghap-love-side h4 {
    text-align: center;
    color: #C0392B;
    margin: 0 0 10px;
    font-size: 1em;
}

.gunghap-love-side p {
    font-size: 0.95em;
    line-height: 1.7;
}

/* Pros and Cons */
.gunghap-pros-cons {
    display: flex;
    gap: 20px;
}

.gunghap-pros, .gunghap-cons {
    flex: 1;
    border-radius: 10px;
    padding: 15px;
}

.gunghap-pros {
    background: rgba(39,174,96,0.08);
    border: 1px solid rgba(39,174,96,0.2);
}

.gunghap-cons {
    background: rgba(192,57,43,0.08);
    border: 1px solid rgba(192,57,43,0.2);
}

.gunghap-pros h4 {
    color: #27ae60;
    margin: 0 0 10px;
}

.gunghap-cons h4 {
    color: #C0392B;
    margin: 0 0 10px;
}

.gunghap-pros ul, .gunghap-cons ul {
    margin: 0;
    padding-left: 20px;
}

.gunghap-pros li, .gunghap-cons li {
    margin-bottom: 6px;
    line-height: 1.6;
}

/* Advice section */
.gunghap-advice {
    background: rgba(218,165,32,0.08);
    border: 1px solid rgba(218,165,32,0.2);
    border-radius: 10px;
    padding: 20px;
    margin-top: 15px;
}

.gunghap-advice h4 {
    color: #DAA520;
    margin: 0 0 10px;
}

.gunghap-advice p {
    line-height: 1.8;
}

/* Action Buttons */
.gunghap-result-actions {
    text-align: center;
    margin-top: 20px;
}

.gunghap-action-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #C0392B, #e74c3c);
    color: #fff;
    border: 2px solid #C0392B;
    border-radius: 10px;
    font-size: 1em;
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin: 5px;
}

.gunghap-action-btn:hover {
    background: linear-gradient(135deg, #a93226, #c0392b);
    box-shadow: 0 4px 15px rgba(192,57,43,0.3);
}

/* ========================================
   History
   ======================================== */

.gunghap-history-title {
    color: #C0392B;
    font-size: 1.3em;
    margin: 0 0 20px;
    text-align: center;
}

.gunghap-history-empty {
    text-align: center;
    color: #a08878;
    padding: 20px;
}

.gunghap-history-item {
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(232,160,176,0.3);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.gunghap-history-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.3s;
}

.gunghap-history-summary:hover {
    background: rgba(192,57,43,0.03);
}

.gunghap-history-info {
    flex: 1;
}

.gunghap-history-info strong {
    color: #C0392B;
    margin-right: 10px;
}

.gunghap-history-info span {
    color: #a08878;
    font-size: 0.9em;
}

.gunghap-history-score {
    font-weight: 700;
    margin-left: 10px;
}

.gunghap-history-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.gunghap-history-toggle {
    background: none;
    border: 1px solid rgba(192,57,43,0.3);
    color: #C0392B;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
    font-family: 'Noto Serif KR', serif;
}

.gunghap-history-delete {
    background: none;
    border: 1px solid rgba(192,57,43,0.3);
    color: #C0392B;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
    font-family: 'Noto Serif KR', serif;
}

.gunghap-history-toggle:hover,
.gunghap-history-delete:hover {
    background: rgba(192,57,43,0.08);
}

.gunghap-history-detail {
    display: none;
    padding: 15px;
    border-top: 1px solid rgba(232,160,176,0.2);
    max-height: 400px;
    overflow-y: auto;
}

.gunghap-history-detail.open {
    display: block;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    #thisgun-gunghap-app {
        padding: 10px;
    }

    .gunghap-section {
        padding: 20px 15px;
    }

    .gunghap-header h2 {
        font-size: 1.8em;
    }

    .gunghap-form-row {
        flex-direction: column;
    }

    .gunghap-vs-divider {
        flex-direction: row;
        min-width: auto;
        padding: 10px 0;
    }

    .gunghap-date-selectors {
        flex-direction: column;
        gap: 6px;
    }

    .gunghap-gender-group {
        flex-direction: row;
        gap: 8px;
    }

    .gunghap-pillars-compare {
        flex-direction: column;
    }

    .gunghap-elements-compare {
        flex-direction: column;
    }

    .gunghap-love-compare {
        flex-direction: column;
    }

    .gunghap-pros-cons {
        flex-direction: column;
    }

    .gunghap-score-gauge {
        width: 160px;
        height: 160px;
    }

    .gunghap-score-number {
        font-size: 2.2em;
    }

    .gunghap-zodiac-emoji {
        font-size: 2.2em;
    }

    .gunghap-history-summary {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .gunghap-result-card {
        padding: 15px;
    }

    .gunghap-subscore-label {
        width: 60px;
        font-size: 0.8em;
    }

    .gunghap-stem-cell,
    .gunghap-branch-cell {
        font-size: 1.1em;
    }
}

/* Decorative */
.gunghap-section::after {
    content: '\2764';
    position: absolute;
    top: 8px;
    right: 12px;
    color: rgba(192,57,43,0.1);
    font-size: 1.5em;
}
