/* ================================================================
   KP JATHAGAM
   Professional UI
================================================================ */


/* ================================================================
   WRAPPER
================================================================ */

.kp-jathagam-wrapper {
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    color: #263238;
}


/* ================================================================
   PAGE HEADER
================================================================ */

.kp-page-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
    padding: 22px 24px;
    border-radius: 18px;
    background: linear-gradient(
        135deg,
        #fff8e7 0%,
        #fffdf8 100%
    );
    border: 1px solid #ead9a6;
    box-shadow:
        0 8px 24px rgba(
            60,
            40,
            10,
            0.07
        );
}


.kp-page-header-icon {
    width: 62px;
    height: 62px;
    min-width: 62px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: #fff;
    border: 1px solid #ead9a6;
}


.kp-page-header h2 {
    margin: 0 0 6px;
    font-size: 26px;
    line-height: 1.25;
}


.kp-page-header p {
    margin: 0;
    color: #68747d;
    font-size: 14px;
    line-height: 1.7;
}


/* ================================================================
   FORM
================================================================ */

.kp-form {
    background: #fff;
    border: 1px solid #e5e8eb;
    border-radius: 18px;
    padding: 22px;
    box-shadow:
        0 8px 28px rgba(
            30,
            40,
            50,
            0.06
        );
}


.kp-section {
    margin-bottom: 25px;
}


.kp-section:last-of-type {
    margin-bottom: 10px;
}


.kp-section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #edf0f2;
    font-size: 17px;
    font-weight: 700;
    color: #37474f;
}


.kp-section-title span:first-child {
    font-size: 20px;
}


/* ================================================================
   GRID
================================================================ */

.kp-grid {
    display: grid;
    gap: 16px;
}


.kp-grid-2 {
    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );
}


.kp-grid-3 {
    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );
}


/* ================================================================
   FIELD
================================================================ */

.kp-field {
    position: relative;
    min-width: 0;
}


.kp-field label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 700;
    color: #455a64;
}


.kp-required {
    color: #c62828;
}


.kp-field input,
.kp-field select {
    width: 100%;
    height: 46px;
    box-sizing: border-box;
    padding: 0 13px;
    border: 1px solid #cfd6da;
    border-radius: 10px;
    background: #fff;
    color: #263238;
    font-size: 14px;
    outline: none;
    transition:
        border-color .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}


.kp-field input:focus,
.kp-field select:focus {
    border-color: #b38a25;
    box-shadow:
        0 0 0 3px rgba(
            179,
            138,
            37,
            0.12
        );
}


.kp-field input::placeholder {
    color: #a1aab0;
}


.kp-field small {
    display: block;
    margin-top: 6px;
    color: #7b858b;
    font-size: 12px;
    line-height: 1.5;
}


/* ================================================================
   PLACE
================================================================ */

.kp-place-main {
    display: grid;
    grid-template-columns:
        minmax(0, 1.2fr)
        minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}


.kp-place-input-wrapper {
    position: relative;
}


.kp-place-input-wrapper input {
    padding-left: 42px;
    padding-right: 42px;
}


.kp-place-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
}


.kp-place-loading {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}


/* ================================================================
   PLACE SUGGESTIONS
================================================================ */

.kp-place-suggestions {
    position: absolute;
    z-index: 1000;
    left: 0;
    right: 0;
    margin-top: 5px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dfe4e7;
    border-radius: 12px;
    box-shadow:
        0 14px 35px rgba(
            20,
            30,
            40,
            0.15
        );
}


.kp-place-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 13px;
    border: 0;
    border-bottom: 1px solid #edf0f2;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition:
        background .15s ease;
}


.kp-place-option:last-child {
    border-bottom: 0;
}


.kp-place-option:hover {
    background: #fff9e9;
}


.kp-place-option-icon {
    font-size: 19px;
}


.kp-place-option-content {
    flex: 1;
    min-width: 0;
}


.kp-place-option-content strong {
    display: block;
    color: #263238;
    font-size: 14px;
}


.kp-place-option-content small {
    display: block;
    margin-top: 3px;
    color: #7a858c;
    font-size: 11px;
}


.kp-place-option-arrow {
    color: #a3832e;
    font-size: 22px;
}


.kp-place-empty {
    padding: 18px;
    text-align: center;
    color: #778188;
    font-size: 13px;
}


/* ================================================================
   COORDINATE CARD
================================================================ */

.kp-coordinate-card {
    padding: 17px;
    border-radius: 14px;
    border: 1px solid #e3e7e9;
    background: #fafbfc;
}


.kp-coordinate-title {
    margin-bottom: 13px;
    font-weight: 700;
    color: #455a64;
}


.kp-auto-filled {
    background: #fffdf2 !important;
    border-color: #c8a341 !important;
}


/* ================================================================
   SELECTED PLACE
================================================================ */

.kp-selected-place {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 12px;
    padding: 10px 13px;
    border-radius: 10px;
    background: #f3fbf5;
    border: 1px solid #cce7d2;
    color: #2e5d39;
    font-size: 13px;
}


.kp-selected-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #3c8d50;
    color: #fff;
    font-weight: 700;
}


.kp-location-note {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 11px;
    background: #fffaf0;
    border: 1px solid #eee0bd;
    color: #66562d;
    font-size: 12px;
    line-height: 1.7;
}


/* ================================================================
   METHOD
================================================================ */

.kp-method-grid {
    display: grid;
    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );
    gap: 12px;
}


.kp-method-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px;
    border: 1px solid #e5e8ea;
    border-radius: 12px;
    background: #fafbfc;
}


.kp-method-icon {
    font-size: 22px;
}


.kp-method-item strong {
    display: block;
    font-size: 12px;
    color: #455a64;
}


.kp-method-item span:not(.kp-method-icon) {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: #7b858b;
}


/* ================================================================
   ACTION
================================================================ */

.kp-action-area {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 8px;
}


.kp-calculate-btn,
.kp-clear-btn {
    min-height: 48px;
    padding: 0 22px;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform .15s ease,
        box-shadow .15s ease,
        opacity .15s ease;
}


.kp-calculate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid #8f6b14;
    background: linear-gradient(
        135deg,
        #c8a13d,
        #a77b16
    );
    color: #fff;
    box-shadow:
        0 7px 17px rgba(
            140,
            100,
            20,
            0.18
        );
}


.kp-calculate-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow:
        0 10px 22px rgba(
            140,
            100,
            20,
            0.23
        );
}


.kp-calculate-btn:disabled,
.kp-clear-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}


.kp-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #ccd3d7;
    background: #fff;
    color: #54636b;
}


.kp-clear-btn:hover:not(:disabled) {
    background: #f7f8f9;
}


.kp-button-icon {
    font-size: 18px;
}


.kp-button-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(
        255,
        255,
        255,
        .45
    );
    border-top-color: #fff;
    animation:
        kp-spin .7s linear infinite;
}


/* ================================================================
   LOADING
================================================================ */

.kp-loading {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 18px;
    padding: 18px;
    border-radius: 14px;
    border: 1px solid #e5e0ca;
    background: #fffdf5;
}


.kp-spinner {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    border: 3px solid #eadfb8;
    border-top-color: #ad8526;
    animation:
        kp-spin .8s linear infinite;
}


.kp-loading-text strong {
    display: block;
    color: #4e4120;
}


.kp-loading-text span {
    display: block;
    margin-top: 3px;
    color: #81734c;
    font-size: 12px;
}


/* ================================================================
   ERROR
================================================================ */

.kp-error {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 18px;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #f0caca;
    background: #fff5f5;
    color: #9b2525;
    font-size: 13px;
    line-height: 1.6;
}


.kp-error-icon {
    font-size: 20px;
}


/* ================================================================
   RESULT
================================================================ */

.kp-result {
    margin-top: 24px;
}


/* ================================================================
   RESULT HEADER
================================================================ */

.kp-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 20px;
    border-radius: 16px;
    background: linear-gradient(
        135deg,
        #fff8e7,
        #fffdf9
    );
    border: 1px solid #ead9a6;
}


.kp-result-header-left {
    display: flex;
    align-items: center;
    gap: 13px;
}


.kp-result-avatar {
    width: 52px;
    height: 52px;
    min-width: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #ead9a6;
    font-size: 26px;
}


.kp-result-header h3 {
    margin: 0;
    font-size: 21px;
}


.kp-result-header p {
    margin: 5px 0 0;
    color: #717d84;
    font-size: 12px;
}


.kp-result-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}


.kp-result-badges span {
    padding: 6px 9px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #e2d6b0;
    color: #6d5a25;
    font-size: 10px;
    font-weight: 700;
}


/* ================================================================
   SUMMARY
================================================================ */

.kp-summary-grid {
    display: grid;
    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );
    gap: 12px;
    margin-top: 14px;
}


.kp-summary-card {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding: 14px;
    border: 1px solid #e5e8ea;
    border-radius: 13px;
    background: #fff;
}


.kp-summary-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f8f4e9;
    font-size: 19px;
}


.kp-summary-card span {
    display: block;
    color: #7a858b;
    font-size: 11px;
}


.kp-summary-card strong {
    display: block;
    margin-top: 3px;
    color: #34444c;
    font-size: 13px;
    word-break: break-word;
}


/* ================================================================
   RESULT SECTION
================================================================ */

.kp-result-section {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid #e3e7e9;
    border-radius: 16px;
    background: #fff;
}


.kp-result-section-title {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 16px;
}


.kp-result-section-title > span {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f8f4e9;
    font-size: 19px;
}


.kp-result-section-title h3 {
    margin: 0;
    font-size: 17px;
    color: #37474f;
}


.kp-result-section-title small {
    display: block;
    margin-top: 2px;
    color: #899299;
    font-size: 11px;
}


/* ================================================================
   CHARTS
================================================================ */

.kp-charts-grid {
    display: grid;
    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );
    gap: 18px;
}


.kp-chart-card {
    min-width: 0;
    padding: 14px;
    border: 1px solid #e2e6e8;
    border-radius: 14px;
    background: #fcfcfb;
}


.kp-chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 13px;
}


.kp-chart-card-header h4 {
    margin: 0;
    font-size: 15px;
    color: #3c4b52;
}


.kp-chart-card-header span:not(
    .kp-chart-type-badge
) {
    display: block;
    margin-top: 3px;
    color: #8a949a;
    font-size: 10px;
}


.kp-chart-type-badge {
    padding: 5px 8px;
    border-radius: 7px;
    background: #f4ecd5;
    color: #755b1d;
    font-size: 10px;
    font-weight: 800;
}


/* ================================================================
   SOUTH INDIAN CHART
================================================================ */

.kp-south-chart {
    position: relative;
    display: grid;
    grid-template-columns:
        repeat(4, 1fr);
    grid-template-rows:
        repeat(4, 1fr);
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 2px solid #786b49;
    background: #fffef9;
}


/* Center */

.kp-chart-center {
    position: absolute;
    left: 25%;
    right: 25%;
    top: 25%;
    bottom: 25%;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fffdf6;
    color: #9a7928;
    pointer-events: none;
}


.kp-chart-center div {
    font-size: 27px;
    font-weight: 700;
}


.kp-chart-center small {
    margin-top: 2px;
    font-size: 9px;
    letter-spacing: 1px;
}


/* Cells */

.kp-chart-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: 5px;
    overflow: hidden;
    border-right: 1px solid #8b8062;
    border-bottom: 1px solid #8b8062;
    background: #fff;
    box-sizing: border-box;
}


/*
 * Remove borders for right-most cells.
 */

.kp-chart-cell.r1c4,
.kp-chart-cell.r2c4,
.kp-chart-cell.r3c4,
.kp-chart-cell.r4c4 {
    border-right: 0;
}


/*
 * Remove borders for bottom row.
 */

.kp-chart-cell.r4c1,
.kp-chart-cell.r4c2,
.kp-chart-cell.r4c3,
.kp-chart-cell.r4c4 {
    border-bottom: 0;
}


/*
 * Side middle cells:
 * preserve perimeter only.
 */

.kp-chart-cell.r2c1,
.kp-chart-cell.r3c1 {
    border-right: 1px solid #8b8062;
}


.kp-chart-cell.r2c4,
.kp-chart-cell.r3c4 {
    border-left: 0;
}


/* Sign */

.kp-chart-sign {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}


.kp-chart-sign strong {
    display: block;
    color: #48565c;
    font-size: 11px;
    line-height: 1.25;
}


.kp-lagna-mark {
    display: inline-block;
    color: #b02d2d;
    font-size: 8px;
    font-weight: 800;
}


.kp-lagna-cell {
    background: #fff9e7;
}


/* Planets */

.kp-chart-planets {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 2px;
    margin-top: 4px;
}


.kp-chart-planet {
    display: inline-block;
    padding: 2px 3px;
    border-radius: 3px;
    background: #f3f4f5;
    color: #37474f;
    font-size: 8px;
    line-height: 1.2;
    word-break: keep-all;
}


.kp-chart-note {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    color: #7a6a36;
    font-size: 10px;
}


/* ================================================================
   TABLE
================================================================ */

.kp-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e4e8ea;
    border-radius: 11px;
}


.kp-data-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 12px;
}


.kp-data-table th {
    padding: 10px 9px;
    background: #f7f8f9;
    border-bottom: 1px solid #dfe4e7;
    color: #58666e;
    font-size: 11px;
    font-weight: 800;
    text-align: left;
    white-space: nowrap;
}


.kp-data-table td {
    padding: 10px 9px;
    border-bottom: 1px solid #edf0f2;
    color: #526169;
    vertical-align: middle;
}


.kp-data-table tbody tr:last-child td {
    border-bottom: 0;
}


.kp-data-table tbody tr:hover {
    background: #fffdf7;
}


/* ================================================================
   RETROGRADE
================================================================ */

.kp-retrograde {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #f8e6e6;
    color: #b12b2b;
    font-size: 10px;
    font-weight: 800;
}


.kp-direct {
    color: #4d8b5a;
    font-size: 11px;
}


/* ================================================================
   DASHA
================================================================ */

.kp-dasha-highlight {
    display: grid;
    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );
    gap: 10px;
    margin-bottom: 13px;
}


.kp-dasha-highlight > div {
    padding: 13px;
    border-radius: 10px;
    background: #fffaf0;
    border: 1px solid #eee1bd;
}


.kp-dasha-highlight span {
    display: block;
    color: #85754d;
    font-size: 10px;
}


.kp-dasha-highlight strong {
    display: block;
    margin-top: 4px;
    color: #5c4a1d;
    font-size: 13px;
}


.kp-dasha-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f5f0df;
    color: #735d25;
    font-size: 10px;
    font-weight: 800;
}


/* ================================================================
   RULING PLANETS
================================================================ */

.kp-ruling-grid {
    display: grid;
    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );
    gap: 10px;
}


.kp-ruling-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px;
    border: 1px solid #e4e8ea;
    border-radius: 11px;
    background: #fafbfc;
}


.kp-ruling-card > span {
    font-size: 19px;
}


.kp-ruling-card small {
    display: block;
    color: #8a949a;
    font-size: 9px;
}


.kp-ruling-card strong {
    display: block;
    margin-top: 2px;
    color: #405058;
    font-size: 12px;
}


/* ================================================================
   ANIMATION
================================================================ */

@keyframes kp-spin {

    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }

}


/* ================================================================
   RESPONSIVE - TABLET
================================================================ */

@media (
    max-width: 1000px
) {

    .kp-method-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .kp-summary-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .kp-ruling-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

}


/* ================================================================
   RESPONSIVE - MOBILE
================================================================ */

@media (
    max-width: 760px
) {

    .kp-jathagam-wrapper {
        padding: 10px;
    }


    .kp-page-header {
        padding: 17px;
        gap: 12px;
    }


    .kp-page-header-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
        font-size: 25px;
    }


    .kp-page-header h2 {
        font-size: 20px;
    }


    .kp-page-header p {
        font-size: 12px;
    }


    .kp-form {
        padding: 15px;
        border-radius: 14px;
    }


    .kp-grid-2,
    .kp-grid-3 {
        grid-template-columns:
            1fr;
    }


    .kp-place-main {
        grid-template-columns:
            1fr;
    }


    .kp-method-grid {
        grid-template-columns:
            1fr;
    }


    .kp-action-area {
        flex-direction: column;
        align-items: stretch;
    }


    .kp-calculate-btn,
    .kp-clear-btn {
        width: 100%;
    }


    .kp-result-header {
        flex-direction: column;
        align-items: flex-start;
    }


    .kp-summary-grid {
        grid-template-columns:
            1fr;
    }


    .kp-charts-grid {
        grid-template-columns:
            1fr;
    }


    .kp-dasha-highlight {
        grid-template-columns:
            1fr;
    }


    .kp-ruling-grid {
        grid-template-columns:
            1fr;
    }


    .kp-result-section {
        padding: 13px;
    }


    .kp-south-chart {
        max-width: 480px;
        margin: 0 auto;
    }

}


/* ================================================================
   VERY SMALL MOBILE
================================================================ */

@media (
    max-width: 420px
) {

    .kp-page-header {
        align-items: flex-start;
    }


    .kp-page-header-icon {
        display: none;
    }


    .kp-section-title {
        font-size: 15px;
    }


    .kp-chart-sign strong {
        font-size: 9px;
    }


    .kp-chart-planet {
        font-size: 7px;
        padding: 1px 2px;
    }


    .kp-chart-center div {
        font-size: 21px;
    }


    .kp-chart-center small {
        font-size: 7px;
    }

}