/**
 * QMDJ Chart Generator Styles
 */

/* Container */
.qmdj-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.qmdj-header {
    text-align: center;
    margin-bottom: 30px;
}

.qmdj-header h2 {
    margin: 0 0 5px 0;
    font-size: 28px;
    color: #1a1a1a;
}

.qmdj-subtitle {
    font-size: 18px;
    color: #666;
    margin: 0;
}

/* Main Content Layout */
.qmdj-main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .qmdj-main-content {
        grid-template-columns: 1fr;
    }
}

/* Form Styles */
.qmdj-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.qmdj-form-group {
    margin-bottom: 15px;
}

.qmdj-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.qmdj-form-group input,
.qmdj-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.qmdj-form-group input:focus,
.qmdj-form-group select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.qmdj-form-row {
    display: flex;
    gap: 10px;
}

.qmdj-form-half {
    flex: 1;
}

/* Buttons */
.qmdj-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qmdj-btn-primary {
    background: #0073aa;
    color: #fff;
    width: 100%;
}

.qmdj-btn-primary:hover {
    background: #005a87;
}

.qmdj-btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
}

.qmdj-btn-secondary:hover {
    background: #e0e0e0;
}

.qmdj-btn-danger {
    background: #dc3232;
    color: #fff;
}

.qmdj-btn-danger:hover {
    background: #b72828;
}

/* Chart Display */
.qmdj-chart-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.qmdj-chart-placeholder {
    text-align: center;
    color: #999;
}

/* Nine Palaces Grid */
.qmdj-chart-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    background: #333;
    padding: 2px;
    max-width: 450px;
    margin: 0 auto;
}

.qmdj-palace {
    background: #fff;
    padding: 15px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.qmdj-palace-header {
    font-weight: bold;
    font-size: 16px;
    color: #0073aa;
    margin-bottom: 8px;
}

.qmdj-deity {
    font-size: 14px;
    color: #9c27b0;
    margin: 2px 0;
}

.qmdj-star {
    font-size: 16px;
    color: #ff5722;
    font-weight: bold;
    margin: 2px 0;
}

.qmdj-door {
    font-size: 14px;
    color: #4caf50;
    margin: 2px 0;
}

.qmdj-palace-number {
    position: absolute;
    bottom: 5px;
    right: 8px;
    font-size: 12px;
    color: #999;
}

/* Palace 5 (Center) special styling */
.qmdj-palace-5 {
    background: #f5f5dc;
}

/* Chart Info Badge */
.qmdj-chart-info {
    margin-top: 20px;
    text-align: center;
}

.qmdj-ju-badge {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: bold;
}

/* Actions */
.qmdj-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

/* Details Panel */
.qmdj-details {
    margin-top: 30px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.qmdj-details h3 {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.qmdj-details-section {
    margin-bottom: 20px;
}

.qmdj-details-section h4 {
    margin: 0 0 10px 0;
    color: #333;
}

/* Four Pillars Display */
.qmdj-pillars,
#qmdj-four-pillars {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.qmdj-pillar-item {
    text-align: center;
    background: #fff;
    padding: 15px 20px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.qmdj-pillar-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.qmdj-pillar-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

/* Ju Info */
.qmdj-ju-info,
#qmdj-ju-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.qmdj-ju-detail {
    background: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

/* Modal */
.qmdj-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.qmdj-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.qmdj-modal-large {
    max-width: 800px;
}

.qmdj-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.qmdj-modal-close:hover {
    color: #333;
}

.qmdj-modal h3 {
    margin: 0 0 20px 0;
}

/* Loading */
.qmdj-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.qmdj-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Autocomplete */
.qmdj-autocomplete {
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    width: 100%;
    box-sizing: border-box;
}

.qmdj-suggestion {
    padding: 10px 12px;
    cursor: pointer;
}

.qmdj-suggestion:hover {
    background: #f0f0f0;
}

/* Q&A Panel */
.qmdj-qa-panel {
    margin-top: 30px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.qmdj-qa-panel h3 {
    margin: 0 0 15px 0;
}

.qmdj-qa-messages {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.qmdj-qa-input {
    display: flex;
    gap: 10px;
}

.qmdj-qa-input textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    min-height: 60px;
}

/* Form group positioning for autocomplete */
.qmdj-form-group {
    position: relative;
}
