/* Relations Page Styles */
/* ===================== */

/* Relationship Indicators */
.relationship-indicator {
    display: inline-block;
    padding: 2px 6px;
    margin: 1px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.rel-good {
    color: #dc3545; /* Red for good relationships */
    border: 1px solid #dc3545;
    background-color: transparent;
}

.rel-bad {
    color: #000000; /* Black for bad relationships */
    border: 1px solid #000000;
    background-color: transparent;
}

.relationship-summary {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* Group Relations Status */
.group-relations-status {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    text-align: center;
}

.status-processing {
    background-color: #cce7ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.status-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Group Relation Items */
.group-relation-item {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.group-relation-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.group-relation-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.group-sanhe {
    background-color: #d4edda;
    color: #0d4419; /* Darker green for better contrast */
    border: 1px solid #c3e6cb;
}

.group-sanxing {
    background-color: #f8d7da;
    color: #58151c; /* Darker red for better contrast */
    border: 1px solid #f5c6cb;
}

/* Group Relation People Display */
.group-relation-people {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 0.5rem;
}

.group-person-info {
    flex: 1;
    min-width: 200px;
    text-align: center;
    margin-bottom: 0.5rem;
}

.group-person-name {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.group-person-bazi {
    font-family: monospace;
    line-height: 1.2;
    color: #000000; /* Force black color for BaZi text */
}

.group-person-bazi .bazi-pillars {
    color: #000000; /* Force black color */
}

.group-person-bazi .bazi-row {
    display: block;
    letter-spacing: 0.3em;
    font-size: 0.9em;
    color: #000000; /* Force black color */
}

/* BaZi Display Components */
.bazi-pillars {
    display: inline-block;
    margin-left: 0.5rem;
    font-family: monospace;
    line-height: 1.2;
    vertical-align: middle;
}

/* Pairwise relations table responsive adjustments */
.table-responsive .table td {
    vertical-align: middle;
}

/* BaZi styling in tables - match charts page style */
.table-responsive .table .bazi-text {
    font-size: 1rem;
    line-height: 1.3;
}

.table-responsive .table .bazi-char {
    margin: 0 0.3rem;
    display: inline-block;
    min-width: 1em;
    text-align: center;
}

.table-responsive .table .bazi-char:first-child {
    margin-left: 0;
}

.table-responsive .table .god-row,
.table-responsive .table .earth-row {
    white-space: nowrap;
}

/* Person name links in pairwise relations */
.person-name-link {
    color: #007bff !important;
    text-decoration: none;
    font-weight: bold;
}

.person-name-link:hover {
    color: #0056b3 !important;
    text-decoration: underline;
}

.person-name-link:visited {
    color: #007bff !important;
}

/* Relations page specific user BaZi display */
.relations-user-bazi-display {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.relations-user-bazi-display h5 {
    margin-bottom: 0.5rem;
    color: #495057;
    font-weight: 600;
}

.relations-user-bazi-display .bazi-text {
    font-size: 1.2rem;
    line-height: 1.4;
}

.relations-user-bazi-display .bazi-char {
    margin: 0 0.5rem;
    display: inline-block;
    min-width: 1em;
    text-align: center;
}

.relations-user-bazi-display .bazi-char:first-child {
    margin-left: 0;
}

/* Mobile adjustments for pairwise relations */
@media (max-width: 768px) {
    .table-responsive .table .bazi-text {
        font-size: 0.9rem;
    }
    
    .table-responsive .table .bazi-char {
        margin: 0 0.2rem;
        font-size: 0.9em;
    }
    
    .relations-user-bazi-display .bazi-text {
        font-size: 1.1rem;
    }
    
    .relations-user-bazi-display .bazi-char {
        margin: 0 0.4rem;
    }
}

.bazi-row {
    display: block;
    letter-spacing: 0.3em;
    font-size: 0.9em;
}

/* Relation Highlighting */
.relation-highlight {
    border: 2px solid #ff6b35;
    border-radius: 50%;
    padding-left: 2px;
    background-color: rgba(255, 107, 53, 0.1);
    color: inherit; /* Keep original character color */
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    line-height: 1.25em;
    margin-left: -3px;
}

/* Only day stem should have 5-element color */
.day-stem-highlight {
    font-weight: bold;
}

/* Links and Interactions */
.person-link {
    color: #007bff !important;
    text-decoration: none;
    cursor: pointer;
}

.person-link:hover {
    color: #0056b3 !important;
    text-decoration: underline;
}

.person-link:visited {
    color: #007bff !important;
}

/* Override link colors for BaZi display */
.person-link .group-person-bazi,
.person-link .group-person-bazi *,
.person-link .bazi-pillars,
.person-link .bazi-pillars *,
.person-link .bazi-row,
.person-link .bazi-row * {
    color: #000000 !important; /* Force black for all BaZi elements in links */
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Relationship Explanation Button - Menu Style */
.relationship-explanation-btn {
    background-color: #e9d5ff !important;
    color: #000 !important;
    border: none !important;
    border-radius: 0.5rem !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 0.875rem !important;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.relationship-explanation-btn:hover {
    background-color: #d8b4fe !important;
    color: #000 !important;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.relationship-explanation-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .group-person-info {
        min-width: 150px;
        flex-basis: 45%;
    }
    
    .relationship-explanation-btn {
        font-size: 0.8rem !important;
        padding: 0.3rem 0.6rem !important;
    }
}
