/* =========================================================
   ISLAMIC CITY - COMPLETE STYLESHEET
   city-g.css | Islamic Light
========================================================= */

/* =========================================================
   ROOT VARIABLES & THEME
========================================================= */

:root {
    --primary: #004d40;
    --primary-light: #00796b;
    --primary-dark: #003c32;

    --green: #2e7d32;
    --light-green: #e8f5e9;

    --sky: #dff3ff;
    --grass: #b9d99a;
    --grass-dark: #8fbd70;

    --road: #8c8c8c;
    --road-dark: #707070;

    --white: #ffffff;
    --black: #222222;
    --gray: #666666;
    --light-gray: #eeeeee;

    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.20);

    --radius: 16px;
}

/* =========================================================
   BASE RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Noto Sans Bengali", "Segoe UI", sans-serif;
    background: #f4f8f6;
    color: var(--black);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Tap Highlight Fix for Mobile */
button,
a,
.city-building,
.city-option,
.mission-card {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* =========================================================
   GAME HEADER
========================================================= */

.city-header {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--white);
    padding: 13px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.city-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.city-header h1 {
    font-size: 21px;
    line-height: 1.2;
    font-weight: 700;
}

.city-header p {
    font-size: 12px;
    opacity: 0.88;
    margin-top: 2px;
}

/* Back Button */
.back-button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    text-decoration: none;
    font-size: 22px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateX(-2px);
}

/* Help Button */
.help-button {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--white);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.help-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* =========================================================
   PLAYER STATUS CARD
========================================================= */

.player-section {
    padding: 15px;
    background: #ffffff;
    border-bottom: 1px solid #e1ebe7;
}

.player-card {
    max-width: 900px;
    margin: auto;
    background: var(--white);
    border: 1px solid #e1ebe7;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.player-avatar {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    background: var(--light-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border: 2px solid #c8e6c9;
}

.player-info {
    min-width: 85px;
}

.player-info h2 {
    font-size: 15px;
    color: var(--primary);
    font-weight: 700;
}

.player-info p {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
    font-weight: 500;
}

.player-xp {
    flex: 1;
}

.xp-text {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 5px;
}

.xp-text strong {
    color: var(--primary);
    font-weight: 700;
}

.xp-bar {
    width: 100%;
    height: 9px;
    background: #e8eee9;
    border-radius: 20px;
    overflow: hidden;
}

.xp-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #43a047, #8bc34a);
    border-radius: 20px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================
   MAIN CONTAINER
========================================================= */

.city-main {
    width: 100%;
    max-width: 1100px;
    margin: auto;
    padding: 20px 15px 50px;
}

.city-intro {
    text-align: center;
    margin-bottom: 22px;
}

.city-intro h2 {
    color: var(--primary);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.city-intro p {
    color: var(--gray);
    font-size: 13.5px;
    line-height: 1.7;
    max-width: 600px;
    margin: auto;
}

/* =========================================================
   CITY MAP
========================================================= */

.city-map {
    position: relative;
    width: 100%;
    min-height: 600px;
    overflow: hidden;
    border-radius: 22px;
    background: var(--grass);
    box-shadow: var(--shadow);
    border: 4px solid #ffffff;
}

/* Sky & Animated Atmosphere */
.city-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 160px;
    background: linear-gradient(180deg, #8fd3f4, var(--sky));
}

.sun {
    position: absolute;
    right: 30px;
    top: 22px;
    font-size: 38px;
    display: inline-block;
    animation: sunGlow 4s ease-in-out infinite;
}

.cloud {
    position: absolute;
    font-size: 30px;
    opacity: 0.9;
    display: inline-block;
}

.cloud-one {
    left: 10%;
    top: 35px;
    animation: floatCloud 8s ease-in-out infinite;
}

.cloud-two {
    left: 50%;
    top: 75px;
    animation: floatCloud 10s ease-in-out infinite 1.5s;
}

@keyframes sunGlow {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px #ffe082); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 10px #ffd54f); }
}

@keyframes floatCloud {
    0% { transform: translateX(0); }
    50% { transform: translateX(20px); }
    100% { transform: translateX(0); }
}

/* Buildings Grid Area */
.city-buildings {
    position: absolute;
    top: 140px;
    left: 0;
    width: 100%;
    min-height: 360px;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: center;
    justify-items: center;
    gap: 25px 18px;
    z-index: 5;
}

/* Building Card */
.city-building {
    width: 145px;
    min-height: 145px;
    border: 0;
    border-radius: 18px;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}

.city-building:hover:not(.locked) {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.city-building:active:not(.locked) {
    transform: scale(0.96);
}

.building-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 8px;
    transition: transform 0.2s ease;
}

.city-building:hover .building-icon {
    transform: scale(1.1);
}

.building-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}

.building-status {
    font-size: 10.5px;
    color: var(--gray);
    margin-top: 4px;
    font-weight: 500;
}

/* Building Variants */
.mosque-building { border-bottom: 5px solid #2e7d32; }
.quran-building { border-bottom: 5px solid #1565c0; }
.library-building { border-bottom: 5px solid #6a1b9a; }
.hajj-building { border-bottom: 5px solid #795548; }
.home-building { border-bottom: 5px solid #ef6c00; }

/* Building Locked State */
.city-building.locked {
    opacity: 0.65;
    filter: grayscale(0.4);
    cursor: not-allowed;
}

.city-building.locked::after {
    content: "🔒";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    font-size: 13px;
}

/* Building Completed State */
.city-building.completed {
    border-color: #81c784;
}

.city-building.completed::before {
    content: "✓";
    position: absolute;
    top: 8px;
    left: 8px;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #2e7d32;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
    z-index: 3;
}

/* Road & Environment */
.city-road {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 105px;
    background: var(--road);
    z-index: 2;
}

.road-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 5px;
    background: repeating-linear-gradient(
        90deg,
        #f8e38b 0,
        #f8e38b 45px,
        transparent 45px,
        transparent 75px
    );
}

.city-trees {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    height: 85px;
    z-index: 4;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    pointer-events: none;
}

.city-trees span {
    font-size: 35px;
    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.15));
}

/* =========================================================
   MISSION PANEL
========================================================= */

.mission-section {
    margin-top: 25px;
    background: var(--white);
    border: 1px solid #e2ebe7;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
}

.mission-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.mission-header h2 {
    color: var(--primary);
    font-size: 19px;
    font-weight: 700;
}

.mission-count {
    background: var(--light-green);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 700;
}

.mission-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mission-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid #e5ece8;
    border-radius: 13px;
    background: #fbfcfc;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mission-card:hover {
    background: #f1f8f5;
    border-color: #b2dfdb;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.mission-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--light-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.mission-info {
    flex: 1;
}

.mission-info h3 {
    font-size: 14.5px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 2px;
}

.mission-info p {
    font-size: 11.5px;
    color: var(--gray);
    line-height: 1.5;
}

.mission-xp {
    font-size: 12px;
    font-weight: 700;
    color: #2e7d32;
    white-space: nowrap;
}

/* =========================================================
   CITY INFO SECTION
========================================================= */

.city-info-section {
    margin-top: 25px;
    padding: 22px;
    border-radius: var(--radius);
    background: #ffffff;
    border: 1px solid #e1ebe7;
    box-shadow: var(--shadow-sm);
}

.city-info-section h2 {
    color: var(--primary);
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: 700;
}

.city-info-section p {
    color: var(--gray);
    font-size: 13px;
    line-height: 1.8;
}

/* =========================================================
   MODAL COMPONENT (BASE & HELP)
========================================================= */

.city-modal,
.help-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.city-modal.active,
.help-modal.active {
    display: flex;
}

.modal-overlay,
.help-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
}

.modal-box,
.help-box {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 410px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--white);
    border-radius: 20px;
    padding: 26px 22px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close,
.help-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #f0f0f0;
    color: #444;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.modal-close:hover,
.help-close:hover {
    background: #e2e2e2;
    transform: rotate(90deg);
}

.modal-icon {
    font-size: 55px;
    margin-bottom: 8px;
    line-height: 1;
}

.modal-box h2 {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 8px;
    font-weight: 700;
}

.modal-box p {
    color: var(--gray);
    font-size: 13.5px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.modal-action,
.help-action {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 13px;
    background: var(--primary);
    color: var(--white);
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.modal-action:hover:not(:disabled),
.help-action:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.modal-action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #80cbc4;
}

/* Help Modal Details */
.help-box {
    text-align: left;
}

.help-box h2 {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 12px;
}

.help-box p {
    color: var(--gray);
    font-size: 13.5px;
    line-height: 1.8;
    margin-bottom: 12px;
}

.help-action {
    margin-top: 10px;
    text-align: center;
}

/* =========================================================
   QUESTION UI & DYNAMIC INTERACTION
========================================================= */

.city-question-progress {
    display: inline-block;
    margin-bottom: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    background: #e8f5e9;
    color: #004d40;
    font-size: 12px;
    font-weight: 700;
}

.city-options {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
}

.city-option {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid #dce7e3;
    border-radius: 12px;
    background: #ffffff;
    color: #333333;
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.city-option:hover:not(:disabled) {
    border-color: #00796b;
    background: #f1f8f6;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.city-option:disabled {
    cursor: default;
}

/* Answer Status Animations */
@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.city-option.correct {
    animation: correctPulse 0.3s ease;
    border-color: #2e7d32 !important;
    background: #e8f5e9 !important;
    color: #1b5e20 !important;
    font-weight: 700;
}

.city-option.wrong {
    animation: wrongShake 0.35s ease;
    border-color: #c62828 !important;
    background: #ffebee !important;
    color: #b71c1c !important;
    font-weight: 700;
}

/* Dynamic Feedback Box */
.city-feedback {
    width: 100%;
    padding: 13px 15px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.7;
    margin: 6px 0 16px;
    animation: fadeIn 0.25s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.city-feedback.success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #1b5e20;
}

.city-feedback.error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #b71c1c;
}

.city-feedback strong {
    display: inline-block;
    margin-bottom: 2px;
}

/* =========================================================
   RESULT VIEW
========================================================= */

.city-result {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin: 14px 0;
    color: #555555;
}

.city-result strong {
    color: #004d40;
    font-size: 36px;
    line-height: 1;
}

.city-result span {
    font-size: 15px;
    font-weight: 500;
}

.city-reward {
    display: inline-block;
    margin: 6px 0 14px;
    padding: 8px 18px;
    border-radius: 20px;
    background: #fff8e1;
    color: #e65100;
    font-size: 15px;
    font-weight: 700;
    border: 1px solid #ffe082;
}

/* =========================================================
   PROFILE VIEW
========================================================= */

.city-profile {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 18px 0;
}

.city-profile div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 75px;
    padding: 10px;
    border: 1px solid #e1ebe7;
    border-radius: 12px;
    background: #f7faf9;
}

.city-profile strong {
    color: #666666;
    font-size: 11.5px;
    font-weight: 500;
    margin-bottom: 4px;
}

.city-profile span {
    color: #004d40;
    font-size: 20px;
    font-weight: 700;
}

/* =========================================================
   RESPONSIVE DESIGN (TABLET & DESKTOP)
========================================================= */

@media (min-width: 600px) {
    .city-header {
        padding: 15px 30px;
    }

    .city-main {
        padding: 25px 20px 50px;
    }

    .city-map {
        min-height: 650px;
    }

    .city-buildings {
        top: 155px;
        grid-template-columns: repeat(3, 1fr);
        gap: 32px;
    }

    .city-building {
        width: 160px;
        min-height: 155px;
    }

    .building-icon {
        font-size: 52px;
    }

    .city-profile {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 900px) {
    .city-header {
        padding: 15px 40px;
    }

    .city-header h1 {
        font-size: 23px;
    }

    .city-main {
        padding: 30px 25px 60px;
    }

    .city-map {
        min-height: 700px;
    }

    .city-buildings {
        top: 165px;
        grid-template-columns: repeat(5, 1fr);
        gap: 20px;
        padding: 30px;
    }

    .city-building {
        width: 165px;
        min-height: 165px;
    }

    .city-road {
        height: 125px;
    }

    .city-trees {
        bottom: 28px;
    }

    .city-trees span {
        font-size: 42px;
    }

  .mission-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

/* =========================================================
   SMALL MOBILE SCREEN (≤ 380px)
========================================================= */

@media (max-width: 380px) {
    .player-card {
        gap: 10px;
        padding: 10px;
    }

    .player-avatar {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }

    .player-info h2 {
        font-size: 13.5px;
    }

    .city-map {
        min-height: 550px;
    }

    .city-buildings {
        top: 130px;
        padding: 12px;
        gap: 18px 10px;
    }

    .city-building {
        width: 130px;
        min-height: 132px;
        border-radius: 15px;
    }

    .building-icon {
        font-size: 42px;
    }

    .building-name {
        font-size: 13px;
    }

    .building-status {
        font-size: 9.5px;
    }

    .city-road {
        height: 85px;
    }

    .city-trees span {
        font-size: 28px;
    }

    .city-option {
        padding: 11px 13px;
        font-size: 13px;
    }
}

/* =========================================================
   ACCESSIBILITY: PREFERS REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    ::before,
    ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
