:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --card-bg-color: #f8f9fa;
    --border-color: #dee2e6;
    --link-color: #007bff;
    --link-hover-color: #0056b3;
    --gradient-start: rgba(248, 249, 250, 0.7);
    --gradient-end: rgba(233, 236, 239, 0.7);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --primary-color: #4dabf7;
    --secondary-color: #adb5bd;
    --card-bg-color: #1e1e1e;
    --border-color: #343a40;
    --link-color: #4dabf7;
    --link-hover-color: #82c9ff;
    --gradient-start: rgba(30, 30, 30, 0.7);
    --gradient-end: rgba(45, 45, 45, 0.7);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

.section {
    padding: 4rem 0;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-heading .section-title {
    margin: 0;
}

.section-icon {
    width: 56px;
    height: 56px;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

ul {
    list-style: none;
}

/* Header & Nav */
.header {
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background-color 0.3s;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    font-size: 1.25rem;
}

.nav-logo img {
    width: 32px;
    height: 32px;
}

.nav-list {
    display: flex;
    gap: 1.5rem;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
}

.theme-toggle .feather-sun { display: none; }
.theme-toggle .feather-moon { display: block; }

[data-theme="dark"] .theme-toggle .feather-sun { display: block; }
[data-theme="dark"] .theme-toggle .feather-moon { display: none; }

.lang-toggle {
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}


/* Home Section */
.home {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end)),
                url("../img/home.jpg") center/cover no-repeat;
    text-align: center;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-title {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.home-subtitle {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.home-description {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.home-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.8rem 1.65rem;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.button-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--link-hover-color));
    color: #fff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
}

.button-ghost {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.button-ghost:hover {
    color: #fff;
    background-color: var(--primary-color);
}

.button:disabled,
.button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

/* What We Do Section */
.what-we-do {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.what-we-do ul {
    list-style: disc;
    padding-left: 1.5rem;
    max-width: 800px;
    margin: 1rem auto 0;
}

.what-we-do li {
    margin-bottom: 0.5rem;
}

/* Projects Section */
.projects {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.project-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .project-cards {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 1.5rem;
    transition: box-shadow 0.3s, transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 0.5rem;
}

.card-links {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
}

/* Publications Section */
.publications {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.publications ul li {
    margin-bottom: 1rem;
}

.publications p {
    margin-top: 0.25rem;
    color: var(--secondary-color);
}

/* Updates Section */
.updates {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.updates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.update-card {
    background-color: rgba(255, 255, 255, 0.9);
    color: #111;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .update-card {
    background-color: rgba(18, 18, 18, 0.9);
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.05);
}

.update-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.4);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.update-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.18);
}

.update-card:hover::after {
    opacity: 1;
}

.update-date {
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--secondary-color);
}

.update-title {
    font-size: 1.25rem;
    margin: 0.35rem 0 0.5rem;
}

.update-text {
    color: var(--secondary-color);
    line-height: 1.4;
}

/* Demo Section */
.demo {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.demo-media {
    display: flex;
    justify-content: center;
}

.demo-image {
    width: 100%;
    max-width: 960px;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg-color);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.demo-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.16);
}

/* Roadmap Section */
.roadmap {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.roadmap-figure {
    display: flex;
    justify-content: center;
}

.roadmap-image {
    width: 100%;
    max-width: 960px;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg-color);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.roadmap-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.16);
}

.image-zoom {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 250;
}

.image-zoom.is-open {
    opacity: 1;
    pointer-events: auto;
}

.image-zoom-frame {
    position: relative;
    max-width: min(1200px, 90vw);
    max-height: 90vh;
    background: var(--bg-color);
    padding: 0.75rem;
    border-radius: 0.75rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-zoom-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
}

.image-zoom-close {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

/* Contact Section */
.contact ul {
    text-align: center;
}

.contact ul li {
    display: inline-block;
    margin: 0 1rem;
}

/* Footer */
.footer {
    padding: 2rem 0;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* Accessibility */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.no-js .nav-menu {
    display: block;
}

body.no-scroll {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 200;
}

.modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-dialog {
    position: relative;
    max-width: 480px;
    width: 100%;
    max-height: calc(100vh - 3rem);
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    z-index: 1;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--secondary-color);
}

.modal-description {
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
}

.modal-dialog h3,
.modal-dialog h2 {
    margin-bottom: 0.5rem;
}

.modal-form .form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.modal-form label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-form input,
.modal-form textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    padding: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--card-bg-color);
    color: var(--text-color);
}

.modal-form textarea {
    resize: vertical;
}

.form-meta {
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.form-status {
    min-height: 1.5rem;
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

.form-status[data-state="success"] {
    color: #2f9e44;
}

.form-status[data-state="error"] {
    color: #e03131;
}

.admin-body {
    min-height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.admin-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 4rem 1rem;
}

.admin-main h1 {
    margin-bottom: 0.5rem;
}

.admin-description {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.button-text {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    text-decoration: underline;
}

.table-wrapper {
    position: relative;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--card-bg-color);
    margin-top: 1rem;
}

.table-wrapper[data-locked="true"] {
    pointer-events: none;
    min-height: 160px;
}

.table-wrapper[data-locked="true"] table {
    filter: blur(2px);
    opacity: 0.4;
}

.table-wrapper[data-locked="true"]::after {
    content: attr(data-overlay-message);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border-radius: 0.5rem;
    font-weight: 600;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.admin-table th {
    background-color: rgba(0, 0, 0, 0.03);
    font-weight: 600;
}

[data-theme="dark"] .admin-table th {
    background-color: rgba(255, 255, 255, 0.05);
}

.admin-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

@media (max-width: 640px) {
    .nav-actions {
        flex-direction: column;
        align-items: flex-end;
    }
}
