:root {
    /* sacred-saffron and saffron-dark removed as per request */
    --temple-gold: #C19A5B;
    /* Premium Gold */
    --temple-gold-light: #EAE2D6;
    /* Soft Gold/Beige */
    --temple-gray: #2D2D2D;
    /* Matched to new text-dark */
    --stone-gray: #666666;
    --sacred-white: #ffffff;
    --stone-text: #2D2D2D;
    --glass-bg: rgba(255, 251, 242, 0.95);
    /* Warm Cream Tint */
    --gold-gradient: linear-gradient(135deg, #C19A5B 0%, #E6B75A 100%);
    --saffron-gradient: linear-gradient(135deg, #C19A5B 0%, #E6B75A 100%);
    /* Unified to Gold Gradient */
    --stone-gradient: linear-gradient(135deg, #2D2D2D 0%, #4a4a4a 100%);
}

.alaya-container {
    max-width: 100%;
    margin: 1.5rem 0;
    padding: 0;
}

.alaya-card {
    background: var(--glass-bg);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.2);
    margin-bottom: 1rem;
}

.alaya-title {
    font-family: 'Noto Serif Telugu', serif !important;
    margin-bottom: 1.5rem;
    color: var(--temple-gray);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 2px solid var(--temple-gold-light);
    padding-bottom: 0.5rem;
    font-weight: 600;
}

/* Form Styles */
.alaya-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.alaya-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alaya-form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--temple-gray);
}

.alaya-form-group input,
.alaya-form-group select {
    padding: 1rem;
    border: 2px solid #cccccc;
    border-radius: 10px;
    background-color: var(--sacred-white);
    font-family: 'Poppins', 'Noto Sans Telugu', sans-serif !important;
    font-size: 1rem;
    transition: all 0.3s;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.alaya-form-group input:focus,
.alaya-form-group select:focus {
    outline: none;
    border-color: var(--temple-gold);
    /* Replaced sacred-saffron */
    box-shadow: 0 0 0 4px rgba(193, 154, 91, 0.1);
    /* Gold tint */
}

/* Results Section */
.alaya-results-section {
    margin-top: 0.5rem;
    animation: fadeIn 0.5s ease-out;
}

.results-heading {
    font-size: 1.5rem;
    color: var(--text-dark);
    border-bottom: 2px solid var(--temple-gold-light);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
    font-family: 'Noto Serif Telugu', serif !important;
}

.result-card-main {
    background: white;
    padding: 1rem 0.5rem;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    max-width: 100%;
    overflow-x: hidden;
}

@media (max-width: 480px) {
    .result-card-main {
        padding: 0.5rem 0.5rem;
    }
}

/* Status Colors */
.status-good,
.param-status-good {
    color: #2e7d32 !important;
}

.status-average {
    color: #f9a825 !important;
}

.status-bad,
.param-status-bad {
    color: #c62828 !important;
}

.verdict-badge,
.sentiment-badge {
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.5rem;
    text-transform: uppercase;
    display: inline-block;
}

.verdict-badge.status-good,
.sentiment-badge.status-good {
    background: #e8f5e9;
    color: #2e7d32 !important;
}

.verdict-badge.status-bad,
.sentiment-badge.status-bad {
    background: #ffebee;
    color: #c62828 !important;
}

/* Table Styles */
.ayadi-results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    border: 1px solid #eee;
}

.ayadi-results-table th {
    background: var(--temple-gold);
    color: white;
    padding: 0.8rem;
    text-align: left;
}

.ayadi-results-table td {
    padding: 0.8rem;
    border-bottom: 1px solid #eee;
    font-size: 0.75rem;
}

/* --- Alaya Library Table Styling --- */
#libraryContent table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 12px 6px;
    margin: 1.5rem 0;
    background: transparent;
}

#libraryContent th,
#libraryContent td {
    padding: 12px 16px;
    border: 1.5px solid var(--temple-gold-light);
    border-radius: 8px;
    background: white;
    text-align: left;
    transition: all 0.2s ease;
    vertical-align: top;
    font-size: 0.95rem;
    /* Better readability for guide content */
}

#libraryContent th {
    background: #fdfaf0;
    color: var(--temple-gray);
    font-weight: 600;
    border-color: var(--temple-gold);
    font-family: 'Noto Serif Telugu', serif !important;
}

@media (min-width: 768px) {
    #libraryContent table {
        border-spacing: 16px 8px;
    }
}

/* Dual-Nested Dimension Card */
.dim-outer-card {
    background: #fffdf2;
    border: 1px solid #e8e0c0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.dim-section-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f2edd5;
}

.dim-section-row:last-child {
    border-bottom: none;
}

.dim-label-text {
    font-weight: 500;
    color: #4a4a4a;
    font-size: 0.95rem;
}

.dim-value-text {
    color: #666;
    font-size: 0.95rem;
    text-align: right;
}

.dim-inner-dashed-card {
    background: #ffffff;
    border: 1px dashed #d1c8a7;
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
}

.dim-inner-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.dim-inner-row:last-child {
    border-bottom: none;
}

.dim-inner-label {
    font-weight: 500;
    color: #333d47;
    font-size: 0.9rem;
}

.dim-inner-value {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
}

.dim-inner-area-label {
    color: #5d6d7e;
    font-weight: 500;
}

.dim-inner-area-value {
    color: #2c3e50;
    font-weight: 500;
}

.dim-summary-footer {
    text-align: center;
    margin-top: 0.8rem;
    font-weight: 500;
    color: #34495e;
    font-size: 0.95rem;
}

.dim-summary-label {
    color: #2c3e50;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Button Styles */
.primary-btn,
.secondary-btn,
.back-btn {
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    border: none;
    text-decoration: none;
}

/* Button styles are now inherited from style.css to ensure consistency with Ayam Calculator */
/* 
.primary-btn {
    background: var(--gold-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(193, 154, 91, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(193, 154, 91, 0.4);
    filter: brightness(1.1);
}

.secondary-btn {
    background: var(--gold-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
    filter: brightness(1.1);
}
*/

.back-btn {
    background: white;
    color: var(--temple-gray);
    border: 2px solid #e0e0e0;
}

.back-btn:hover {
    background: #f5f5f5;
    border-color: var(--temple-gray);
}

.btn-reset {
    background: #2d3748 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(74, 85, 104, 0.15) !important;
}

.btn-reset:hover {
    background: #2D3748 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(74, 85, 104, 0.25) !important;
}

.footer-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Specific button overrides */
#calculateBtn {
    width: 100%;
    font-size: 1.1rem;
    padding: 1.2rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .alaya-card {
        padding: 0.5rem;
    }

    .alaya-form-grid {
        grid-template-columns: 1fr;
    }

    .ayadi-results-table {
        font-size: 0.85rem;
    }

    .footer-actions {
        flex-direction: column;
    }

    .primary-btn,
    .secondary-btn,
    .back-btn {
        width: 100%;
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .dim-outer-card {
        padding: 1rem;
    }

    .dim-label-text,
    .dim-value-text,
    .dim-inner-label,
    .dim-inner-value {
        font-size: 0.85rem;
    }

    .alaya-title {
        font-size: 1.2rem;
    }

    .user-info-summary {
        grid-template-columns: 1fr !important;
        padding: 0.5rem !important;
        font-size: 0.8rem !important;
    }

    .report-header h1 {
        font-size: 1.2rem !important;
    }
}

/* --- Alaya Input Width Fix (Results Active) --- */
/* Forces inputs to maintain 100% max-width on small screens when wide report tables are present */
@media (max-width: 600px) {

    /* Fix: Allow natural width, constrain max width */
    /* Fix: Allow natural width, constrain max width */
    .results-active .alaya-form-grid,
    .results-active .form-row {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        margin: 0 !important;
    }

    .results-active .user-info-summary {
        grid-template-columns: 1fr !important;
        width: auto !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    .results-active .alaya-form-group,
    .results-active .form-group {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        min-width: 0;
        /* Flexbox safety */
    }

    .results-active input,
    .results-active select {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .results-active .calc-input-card {
        padding: 1rem !important;
        width: 100% !important;
        /* Ensure it fills parent */
        max-width: 100% !important;
        /* Stop expansion */
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden;
        /* Contain children */
    }
}

/* Library Section Titles */
.alaya-section-title {
    color: var(--temple-gold);
    /* Replaced sacred-saffron */
    margin-top: 2rem;
    border-bottom: 2px solid var(--temple-gold-light);
    padding-bottom: 0.5rem;
    font-family: 'Noto Serif Telugu', serif !important;
    font-size: 1.3rem;
    font-weight: 600;
}

.lib-article {
    margin-bottom: 1.5rem;
    padding-left: 0.5rem;
}

.lib-article h4 {
    color: var(--temple-gray);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.lib-article p {

    margin-left: 1.8rem;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
}

/* --- Modal Backdrop Fix --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-backdrop.active {
    display: flex;
}

.modal-window {
    background: white;
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: modalSlideUp 0.3s ease-out;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--secondary-royal);
    font-family: 'Noto Serif Telugu', serif !important;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    line-height: 1.6;
    color: #444;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Global Layout Spacing Refinement --- */
/* Target the Alaya view specifically and reduce outer margins/padding */
/* REMOVED: Specific padding overrides to maintain consistency with Gruha calculator */

/* --- Result Status Colors (Global for UI and PDF) --- */
.text-good {
    color: #2e7d32 !important;
    /* Green */
    font-weight: 500 !important;
}

.text-bad {
    color: #c62828 !important;
    /* Red */
    font-weight: 500 !important;
}

.text-neutral,
.text-avg {
    color: #f9a825 !important;
    /* Amber/Yellow for average */
    font-weight: 500 !important;
}

/* --- Validation Styles --- */
.input-error {
    border-color: #f44336 !important;
    background-color: #ffebee !important;
    box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.2) !important;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #323232;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    color: #ff5252;
}

/* Summary Alignment Update */
.summary-row {
    display: grid;
    grid-template-columns: 110px 20px 1fr;
    /* Fixed Label, Separator, Value */
    align-items: center;
    /* Align text vertically */
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.summary-row .label {
    color: #555;
    /* Slightly darker than #666 for readability */
    font-weight: 500;
}

.summary-row .sep {
    text-align: center;
    color: var(--temple-gold);
    font-weight: 600;
}

.summary-row .value {
    text-align: left;
    font-weight: 600;
    color: var(--secondary-navy);
}

/* Adjust for mobile if needed */
@media (max-width: 480px) {
    .summary-row {
        grid-template-columns: 90px 15px 1fr;
        /* Slightly tighter on mobile */
        font-size: 0.9rem;
    }
}