@font-face {
    font-family: 'Google Sans Flex';
    src: url('fonts/googlesansflex.ttf');
}

html {
    overflow-y: scroll;
}

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

:root {
    /* Light Mode */
    --bg-color: #f0f0f0;
    --card-color: #ffffff;
    --text-color: #1a1a1a;
    --accent-color: #d9d9d9;
}

body.dark-mode {
    /* Dark Mode */
    --bg-color: #121212;
    --card-color: #000000;
    --text-color: #e0e0e0;
    --accent-color: #1f1f1f;
}

body {
    font-family: 'Google Sans Flex', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.site-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 80px;
    padding: 0 15px;
    background-color: var(--bg-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease;
}

.site-identity {
    font-weight: 600;
    font-size: 1.5rem;
    justify-self: start;
    line-height: 1;
    margin-left: 15px;
}

.site-navigation {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-self: center;
}

.site-navigation a {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    font-size: 0.9rem;
}

.header-spacer {
    display: none;
}

.theme-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--card-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    grid-column: 3;
    grid-row: 1;
    color: var(--text-color);
    transition: background-color 0.3s ease, border-radius 0.3s ease;
}

.theme-toggle:active {
    border-radius: 16px;
}

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

body.dark-mode .theme-toggle .sun-icon { display: block; }
body.dark-mode .theme-toggle .moon-icon { display: none; }

main {
    flex: 1;
    padding-top: 80px;
    background-color: var(--bg-color);
    transition: background-color 0.3s ease;
}

#carousel-container {
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-top: 60px;
    padding-bottom: 120px;
    transition: background-color 0.3s ease;
}

.carousel-controls {
    display: flex;
    gap: 16px;
    margin-top: 30px;
}

.control-btn {
    height: 58px;
    border: none;
    background-color: var(--card-color);
    cursor: pointer;
    transition: background-color 0.3s ease, border-radius 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.control-btn.circle {
    width: 58px;
    border-radius: 50%;
}

.control-btn.pill {
    width: 140px;
    border-radius: 29px;
}

.control-btn:active {
    border-radius: 16px;
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.control-btn .chevron-icon {
    fill: none;
    stroke: var(--text-color);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.control-btn .play-icon,
.control-btn .pause-icon {
    fill: var(--text-color);
}

.control-btn .play-icon {
    stroke: var(--text-color);
    stroke-width: 3;
    stroke-linejoin: round;
}

.control-btn .play-icon { display: none; }
.control-btn .pause-icon { display: block; }
.control-btn.paused .play-icon { display: block; }
.control-btn.paused .pause-icon { display: none; }

.carousel-track {
    display: flex;
    gap: 30px;
    align-self: flex-start; /* Prevents flexbox from centering the track, allowing JS to control position */
    transition: transform 1s ease-in-out;
}

.carousel-card {
    height: 660px;
    aspect-ratio: 5 / 3;
    background-color: var(--card-color);
    border-radius: 30px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: 650;
    color: white;
    text-decoration: none;
    font-size: 2.5rem;
    position: relative;
    opacity: 0;
    transition: background-color 0.3s ease, opacity 0.2s ease 0.8s;
    /* Moved from JS */
    pointer-events: none;
}

.carousel-card.active {
    opacity: 1;
    transition: background-color 0.3s ease, opacity 0.5s ease;
    /* Moved from JS */
    pointer-events: auto;
}

#projects-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 30px;
    gap: 30px;
    background-color: var(--bg-color);
    transition: min-height 1s ease, background-color 0.3s ease;
    min-height: 0;
    position: relative;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.project-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--card-color);
    aspect-ratio: 4 / 3;
    text-decoration: none;
    color: white;
    font-weight: 650;
    border-radius: 30px;
    font-size: 1.5rem;
    position: relative;
    animation: fadeInUp 0.4s ease-out backwards;
    transition: background-color 0.3s ease;
}

.carousel-card img, .project-card img {
    position: absolute;
    top: 30px;
    left: 30px;
    width: calc(100% - 60px);
    height: calc(100% - 60px);
    object-fit: contain;
    border-radius: 12px;
    z-index: 0;
    transition: filter 0.3s ease;
}

.carousel-card:hover img, .project-card:hover img {
    filter: blur(5px);
}

.carousel-card > div, .project-card > div {
    position: relative;
    z-index: 2;
    transition: opacity 0.3s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Hide text by default on cards with images */
.carousel-card > div, .project-card > div {
    opacity: 0;
    transform: translateY(20px);
}

.carousel-card:hover > div, .project-card:hover > div {
    opacity: 1;
    transform: translateY(0);
}

/* Dimming overlay */
.carousel-card::after, .project-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.carousel-card:hover::after, .project-card:hover::after {
    opacity: 1;
}

footer {
    height: 300px;
    background-color: var(--bg-color);
    position: relative;
    transition: background-color 0.3s ease;
}

.project-date {
    font-size: 1.2rem;
    color: inherit;
    opacity: 0.8;
}

.carousel-card .project-date {
    font-size: 1.5rem;
}

.admin-trigger {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent-color);
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    z-index: 9999;
    outline: none;
}

/* --- Project Page Styles --- */
.project-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.project-hero {
    text-align: center;
    margin-bottom: 2rem;
}

.project-hero h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.project-meta {
    font-size: 1.2rem;
    color: var(--accent-color);
}

.project-main-image img {
    width: 100%;
    height: auto;
    border-radius: 30px;
    margin-bottom: 2rem;
}

.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 2rem;
}

.project-gallery img {
    width: 100%;
    height: auto;
    border-radius: 15px;
    transition: transform 0.2s;
}

.project-gallery img:hover {
    transform: scale(1.02);
}

/* Search UI Classes */
.search-ui-container {
    background-color: var(--bg-color);
    transition: background-color 0.3s ease;
    /* Moved from JS */
    width: 100%;
    height: 58px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}
.search-ui-input {
    background-color: var(--card-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    /* Moved from JS */
    width: 100%;
    height: 100%;
    border-radius: 29px;
    border: none;
    padding: 0 50px 0 20px;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
}

.search-ui-input::placeholder {
    color: var(--text-color);
    opacity: 1;
}

.search-ui-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 100%;
}

.search-clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent-color);
    display: none;
    padding: 0;
    align-items: center;
    justify-content: center;
}

/* Admin Popup Styles */
.admin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
}

.admin-overlay.active {
    display: flex;
}

.admin-popup-box {
    background: var(--card-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    padding: 30px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    font-family: 'Google Sans Flex', system-ui, sans-serif;
    min-width: 280px;
}

.admin-popup-input {
    background-color: var(--card-color);
    border: 1px solid var(--accent-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    padding: 12px 20px;
    width: 100%;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    margin-bottom: 30px;
    text-align: center;
}

.admin-popup-btn {
    padding: 10px 30px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
}

/* Generic Dark Mode Support (About, Contact, etc.) */
body.dark-mode input:not(.search-ui-input):not(.admin-popup-input),
body.dark-mode textarea,
body.dark-mode select {
    background-color: var(--card-color);
    color: var(--text-color);
    border: 1px solid var(--accent-color);
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: var(--accent-color);
}

body.dark-mode .search-ui-input::placeholder {
    color: var(--text-color);
}

body.dark-mode main p a,
body.dark-mode main li a {
    color: var(--text-color);
}

/* --- Dashboard Styles (Moved from HTML) --- */
.dashboard-body { background-color: #f0f2f5; padding: 2rem; display: block; }
.dashboard-container { max-width: 1200px; margin: 0 auto; }

/* Header & Create Button */
.dash-header { background: white; padding: 30px; border-radius: 30px; margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center; position: relative; }
.btn-create { background-color: #007bff; color: white; height: 40px; padding: 0 10px 0 15px; border: none; border-radius: 12px; font-size: 1rem; font-weight: 600; font-family: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn-create:hover { background-color: #0056b3; }
.btn-back { background: #979797; color: white; height: 40px; width: 80px; padding: 0; text-decoration: none; border-radius: 12px; border: none; cursor: pointer; font-size: 1rem; font-weight: 600; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; }
.btn-save { background-color: #28a745; color: white; height: 40px; width: 80px; padding: 0; border: none; border-radius: 12px; font-size: 1rem; font-weight: 600; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn-save:disabled { background-color: #e2e2e2; cursor: default; }
.btn-save:not(:disabled):hover { background-color: #218838; }
.btn-reset { background-color: #dc3545; color: white; height: 40px; width: 80px; padding: 0; border: none; border-radius: 12px; font-size: 1rem; font-weight: 600; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn-reset:disabled { background-color: #e2e2e2; cursor: default; }
.btn-reset:not(:disabled):hover { background-color: #c82333; }

.status-card {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    padding: 0.5rem 1.5rem; border-radius: 30px; font-size: 1rem; font-weight: bold;
    background-color: #e2e6ea; color: #333; transition: background-color 0.3s, color 0.3s, opacity 0.3s;
    opacity: 0; pointer-events: none;
}
.status-card.visible { opacity: 1; pointer-events: auto; }
.status-card.unsaved { background-color: #fff3cd; color: #856404; border: 2px solid #856404; }
.status-card.saved { background-color: #d4edda; color: #155724; border: 2px solid #155724; }
.status-card.error { background-color: #f8d7da; color: #721c24; border: 2px solid #721c24; }

/* Carousel Manager Section */
.carousel-manager { background: white; padding: 30px; border-radius: 30px; margin-bottom: 30px; display: flex; flex-direction: column; min-height: 300px; position: relative; }
.carousel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.carousel-manager h2 { text-align: left; margin: 0; color: #333; }
.slots-container { display: flex; gap: 30px; justify-content: center; }
.slot { flex: 1; height: 200px; border: 3px dashed #ccc; border-radius: 12px; display: flex; align-items: center; justify-content: center; position: relative; background: #fafafa; transition: all 0.2s; cursor: grab; }
.slot:active { cursor: grabbing; }
.slot.drag-over { border-color: #007bff; background: #e7f1ff; transform: scale(1.05); z-index: 10; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.slot-content { width: 100%; height: 100%; border-radius: 8px; overflow: hidden; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #333; color: white; }
.slot-content img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; opacity: 0.6; }
.slot-content span { position: relative; z-index: 2; font-weight: bold; text-align: center; padding: 5px; }

.slot-actions { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; gap: 20px; opacity: 0; transition: opacity 0.2s; border-radius: 8px; z-index: 10; }
.slot:hover .slot-actions { opacity: 1; }
.slot-btn { background: #333; color: white; border: none; width: 50px; height: 50px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.slot-btn:hover { background: #555; }
.slot-btn.delete { background: #dc3545; }

/* Project Grid Section */
.grid-section { background: white; padding: 2rem; border-radius: 30px; }
.grid-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; position: relative; }
.grid-header h2 { margin: 0; color: #333; }
.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.dash-card { background: #f0f0f0; border-radius: 22px; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; position: relative; overflow: hidden; }
.dash-card img { width: 100%; height: 220px; object-fit: cover; border-radius: 12px; background: #ddd; display: block; }
.dash-card-info { display: flex; justify-content: space-between; align-items: center; }
.dash-card-title { font-weight: bold; font-size: 1.1rem; }
.dash-card-date { color: #666; font-size: 0.9rem; }

.empty-msg { color: #999; font-style: italic; }

.card-actions { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.15); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; margin: 0; padding: 20px; opacity: 0; transition: opacity 0.2s; z-index: 20; border-radius: 22px; }
.dash-card:hover .card-actions { opacity: 1; }
.action-btn { width: 120px; height: 40px; padding: 0; border: none; border-radius: 12px; cursor: pointer; font-size: 0.9rem; color: #333; background-color: white; font-weight: 600; font-family: inherit; transition: opacity 0.2s; display: flex; align-items: center; justify-content: center; }
.action-btn:hover { opacity: 0.9; }
.action-btn.btn-delete { background-color: #dc3545; color: white; }
.action-btn.btn-delete:hover { background-color: #c82333; opacity: 1; }

/* Modal Styles */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: center; z-index: 2000; }
.modal-content { background: white; padding: 2rem; border-radius: 30px; width: 90%; max-width: 500px; }
.modal-content h2 { margin-bottom: 1.5rem; text-align: center; color: #333; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: bold; color: #333; }
.form-group input { width: 100%; padding: 0.8rem; border: 1px solid #ddd; border-radius: 8px; font-family: inherit; font-size: 1rem; }
.modal-actions { display: flex; gap: 10px; margin-top: 2rem; }
.modal-btn { flex: 1; height: 40px; padding: 0; border: none; border-radius: 12px; font-weight: 600; font-family: inherit; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.modal-btn-back { background-color: #979797; color: white; }
.modal-btn-save { background-color: #28a745; color: white; }
.modal-btn-save:disabled { background-color: #e2e2e2; cursor: default; }
.btn-feature { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 8px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; background: #f8f9fa; color: #6c757d; transition: all 0.2s; z-index: 30; }
.btn-feature:hover { background: #e2e6ea; color: #495057; }
.btn-feature.featured { background: #007bff; color: white; }
.btn-feature.featured svg { fill: white; stroke: white; }
.modal-btn-delete { background-color: #dc3545; color: white; }
.modal-btn-delete:hover { background-color: #c82333; }

/* New Additions for UX */
.search-bar { padding: 0 45px; text-align: center; height: 40px; border: 1px solid #ddd; border-radius: 12px; width: 600px; font-family: inherit; font-size: 1rem; margin: 0; position: absolute; left: 50%; transform: translateX(-50%); background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>') no-repeat 15px center; }
.img-preview-box { margin-top: 10px; height: 120px; background: #f8f9fa; border: 1px solid #ddd; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.img-preview-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* FIX: Prevent sticky hover states during scroll or animation */
.disable-hover,
.disable-hover * {
    pointer-events: none !important;
}

html.no-scroll {
    overflow: hidden !important;
}