:root {
    --bg-color: #0b0b0b;
    --card-bg: #161616;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #FF6900;
    --accent-hover: #e05c00;
    --border-color: #2a2a2a;
    --font-main: 'Tajawal', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Info Buttons */
.info-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.btn-info {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.3s ease;
}

.btn-info:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding-bottom: 60px;
}

/* Card */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-color);
}

.card-image-wrapper {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card:hover .card-image-wrapper img {
    transform: scale(1.05);
}

.card-content {
    padding: 20px;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.card-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* Modal Overlay (Container) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Mobile first */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
    /* Ensure it doesn't block clicks when hidden */
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    /* Re-enable clicks when active */
}

/* Modal Content Wrapper */
.modal {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
    /* Let clicks pass through to overlay if needed, but content needs pointer-events: auto */
}

@media (min-width: 768px) {
    .modal-overlay {
        align-items: center;
    }

    .modal {
        align-items: center;
    }
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    width: 100%;
    max-width: 800px;
    height: 90vh;
    border-radius: 24px 24px 0 0;
    overflow: hidden;
    /* Disable scroll on main container */
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.modal-scroll-content {
    flex-grow: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    /* Crucial for flex child scrolling */
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .modal-content {
        height: 85vh;
        border-radius: 24px;
        transform: translateY(50px);
        opacity: 0;
    }

    .modal-overlay.active .modal-content {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    /* LTR */
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-btn:hover {
    background: var(--accent-color);
}

/* Simple Header (Info Mode) */
.modal-simple-header {
    padding: 20px 30px;
    background: var(--card-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    z-index: 10;
}

.modal-simple-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

/* Hero Image (Apartment Mode) */
.modal-hero-wrapper {
    width: 100%;
    height: 300px;
    position: relative;
    flex-shrink: 0;
}

.modal-hero-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 40px 30px 20px;
}

.modal-hero-overlay h2 {
    font-size: 2rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.modal-body {
    padding: 30px;
    flex-grow: 1;
}

.modal-section {
    margin-bottom: 40px;
}

.modal-section h3 {
    color: var(--accent-color);
    font-size: 1.4rem;
    margin: 0;
    /* Reset margin as it's now in flex container */
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: var(--font-main);
}

.copy-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.copy-btn.copied {
    background: #00C851;
    border-color: #00C851;
    color: white;
}

.list-findings,
.list-improvements {
    list-style: none;
}

.list-findings li,
.list-improvements li {
    position: relative;
    padding-left: 25px;
    /* LTR */
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.list-findings li::before {
    content: "•";
    color: #ff4444;
    font-weight: bold;
    position: absolute;
    left: 0;
    /* LTR */
    font-size: 1.5rem;
    line-height: 1.2rem;
}

.list-improvements li::before {
    content: "✓";
    color: #00C851;
    font-weight: bold;
    position: absolute;
    left: 0;
    /* LTR */
}

.highlight-text {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
    background: rgba(199, 161, 122, 0.1);
    /* Light accent background */
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
}

.list-numbered {
    list-style: decimal;
    padding-left: 25px;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.list-numbered li {
    margin-bottom: 12px;
    padding-left: 5px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-number {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.modal-footer {
    padding: 20px 30px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
}

/* Guide Content Styles */
.guide-content {
    color: var(--text-secondary);
    line-height: 1.6;
}

.guide-content h3 {
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.guide-content p {
    margin-bottom: 1rem;
}

.guide-content strong {
    color: var(--accent-color);
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #111;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}