/* ============================================================
 * TuVi Free Tools — Phong Thủy SĐT
 * ============================================================ */

.tuvi-tools-wrapper {
    max-width: 720px;
    margin: 30px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a2e;
    padding: 0 16px;
    box-sizing: border-box;
}

.tuvi-tools-wrapper * {
    box-sizing: border-box;
}

.tuvi-tools-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(118, 75, 162, 0.12);
}

/* ============================================================
 * HEADER
 * ============================================================ */
.tuvi-tools-header {
    text-align: center;
    padding: 32px 24px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.tuvi-tools-icon {
    font-size: 3em;
    margin-bottom: 8px;
}

.tuvi-tools-title {
    font-size: 1.6em;
    font-weight: 800;
    margin: 0 0 8px;
    font-family: 'Playfair Display', serif;
}

.tuvi-tools-sub {
    font-size: 0.95em;
    opacity: 0.9;
    margin: 0;
    line-height: 1.5;
}

/* ============================================================
 * FORM
 * ============================================================ */
.tuvi-tools-form {
    padding: 28px 24px;
}

.tuvi-tools-label {
    display: block;
    font-weight: 600;
    font-size: 0.95em;
    color: #333;
    margin-bottom: 8px;
}

.tuvi-tools-input-group {
    position: relative;
    margin-bottom: 12px;
}

.tuvi-tools-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    pointer-events: none;
}

.tuvi-tools-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    font-size: 1.2em;
    font-weight: 600;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
}

.tuvi-tools-input:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 4px rgba(118, 75, 162, 0.1);
}

.tuvi-tools-error {
    background: #fee;
    color: #c0392b;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9em;
    margin-bottom: 12px;
    border-left: 3px solid #c0392b;
}

.tuvi-tools-submit {
    width: 100%;
    padding: 16px;
    font-size: 1.1em;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

.tuvi-tools-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(118, 75, 162, 0.4);
}

.tuvi-tools-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.tuvi-tools-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: tuvi-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

.tuvi-tools-note {
    text-align: center;
    font-size: 0.85em;
    color: #888;
    margin-top: 14px;
}

/* ============================================================
 * RESULT
 * ============================================================ */
.tuvi-tools-result {
    padding: 28px 24px;
    animation: tuvi-fade-in 0.4s ease-out;
}

@keyframes tuvi-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tuvi-tools-score-wrap {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #f8f9ff, #fff8f0);
    border-radius: 16px;
}

.tuvi-tools-score-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    background: conic-gradient(#27ae60 0deg, #f0f0f0 0deg);
}

.tuvi-tools-score-circle::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: #fff;
    border-radius: 50%;
}

.tuvi-tools-score-num {
    position: relative;
    font-size: 2.5em;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1;
}

.tuvi-tools-score-label {
    position: relative;
    font-size: 0.8em;
    color: #888;
    margin-top: 4px;
}

.tuvi-tools-score-info {
    flex: 1;
}

.tuvi-tools-rating {
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 6px;
}

.tuvi-tools-phone-display {
    font-size: 1.1em;
    color: #555;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.tuvi-tools-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.tuvi-stat {
    font-size: 0.85em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tuvi-stat .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.tuvi-stat-cat .dot { background: #27ae60; }
.tuvi-stat-hung .dot { background: #e74c3c; }

/* Recommendation */
.tuvi-tools-recommend {
    background: #fff8e1;
    border-left: 4px solid #d4af37;
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 0.95em;
    line-height: 1.6;
    color: #5a4a1f;
}

/* Tail section */
.tuvi-tools-tail {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 24px;
    border: 2px solid #e8eaf6;
}

.tuvi-tools-tail-header {
    font-weight: 700;
    color: #764ba2;
    margin-bottom: 12px;
    font-size: 1.05em;
}

.tuvi-tools-tail-body {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tuvi-tools-tail-pair {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    flex-shrink: 0;
}

.tuvi-tools-tail-info {
    flex: 1;
}

.tuvi-tools-tail-name {
    font-size: 1.1em;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.tuvi-tools-tail-meaning {
    font-size: 0.9em;
    color: #555;
    line-height: 1.5;
}

.tuvi-tools-tail-note {
    font-size: 0.85em;
    color: #888;
    margin: 12px 0 0;
    font-style: italic;
}

/* ============================================================
 * 4 ASPECTS
 * ============================================================ */
.tuvi-tools-section-title {
    font-size: 1.15em;
    font-weight: 700;
    margin: 0 0 14px;
    color: #1a1a2e;
}

.tuvi-tools-aspects {
    margin-bottom: 24px;
}

.tuvi-tools-aspects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.tuvi-aspect-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 14px;
}

.tuvi-aspect-card.good { border-color: #27ae60; background: #e8f8f0; }
.tuvi-aspect-card.mid { border-color: #f39c12; background: #fff8e8; }
.tuvi-aspect-card.low { border-color: #e74c3c; background: #fee8e8; }

.tuvi-aspect-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tuvi-aspect-icon {
    font-size: 1.3em;
}

.tuvi-aspect-name {
    font-weight: 700;
    flex: 1;
    font-size: 0.95em;
}

.tuvi-aspect-score {
    font-size: 0.85em;
    font-weight: 600;
    color: #666;
}

.tuvi-aspect-bar {
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.tuvi-aspect-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

.good .tuvi-aspect-bar-fill { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.mid .tuvi-aspect-bar-fill { background: linear-gradient(90deg, #f39c12, #f1c40f); }
.low .tuvi-aspect-bar-fill { background: linear-gradient(90deg, #e74c3c, #c0392b); }

.tuvi-aspect-desc {
    font-size: 0.85em;
    color: #555;
    line-height: 1.5;
}

/* ============================================================
 * PAIRS LIST
 * ============================================================ */
.tuvi-tools-pairs {
    margin-bottom: 24px;
}

.tuvi-tools-pairs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tuvi-pair-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #eee;
    background: #fff;
}

.tuvi-pair-row.cat { border-color: #c8e6c9; background: #f1f8f4; }
.tuvi-pair-row.hung { border-color: #ffcdd2; background: #fef5f5; }

.tuvi-pair-num {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: #fff;
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    flex-shrink: 0;
}

.cat .tuvi-pair-num { color: #27ae60; }
.hung .tuvi-pair-num { color: #e74c3c; }

.tuvi-pair-info {
    flex: 1;
    min-width: 0;
}

.tuvi-pair-name {
    font-weight: 700;
    font-size: 0.95em;
    margin-bottom: 2px;
}

.tuvi-pair-meaning {
    font-size: 0.85em;
    color: #666;
    line-height: 1.4;
}

.tuvi-pair-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.cat .tuvi-pair-tag { background: #27ae60; }
.hung .tuvi-pair-tag { background: #e74c3c; }

/* ============================================================
 * CTA
 * ============================================================ */
.tuvi-tools-cta {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 16px;
    padding: 24px;
    color: #fff;
    margin-bottom: 24px;
    text-align: center;
}

.tuvi-tools-cta-title {
    font-size: 1.2em;
    font-weight: 700;
    margin: 0 0 8px;
}

.tuvi-tools-cta-sub {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0 0 16px;
    line-height: 1.5;
}

.tuvi-tools-cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.tuvi-tools-cta-btn {
    display: block;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95em;
    transition: background 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tuvi-tools-cta-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.tuvi-tools-cta-btn.primary {
    background: #fff;
    color: #764ba2;
    font-weight: 700;
}

.tuvi-tools-cta-btn.primary:hover {
    background: #f5f5f5;
    color: #5a3a8e;
}

/* ============================================================
 * SHARE
 * ============================================================ */
.tuvi-tools-share {
    text-align: center;
    margin-bottom: 18px;
    padding: 16px;
    background: #f8f9ff;
    border-radius: 12px;
}

.tuvi-tools-share-text {
    margin: 0 0 10px;
    font-size: 0.9em;
    color: #666;
}

.tuvi-tools-share-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.tuvi-share-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
}

.tuvi-share-btn.fb { background: #1877f2; }
.tuvi-share-btn.zalo { background: #0068ff; }
.tuvi-share-btn.copy { background: #555; }

.tuvi-tools-retry {
    display: block;
    width: 100%;
    padding: 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: background 0.2s;
}

.tuvi-tools-retry:hover {
    background: #e0e0e0;
}

/* ============================================================
 * RESPONSIVE
 * ============================================================ */
@media (min-width: 600px) {
    .tuvi-tools-cta-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    .tuvi-tools-cta-btn {
        flex: 1 1 200px;
    }
}

@media (max-width: 480px) {
    .tuvi-tools-header { padding: 24px 18px 18px; }
    .tuvi-tools-title { font-size: 1.3em; }
    .tuvi-tools-form, .tuvi-tools-result { padding: 20px 16px; }
    .tuvi-tools-score-wrap { flex-direction: column; text-align: center; padding: 18px; }
    .tuvi-tools-aspects-grid { grid-template-columns: 1fr; }
    .tuvi-tools-tail-body { flex-direction: column; text-align: center; }
}
