/* =========================
   GLOBAL STYLES
========================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    color-scheme: dark;
}

body {
    min-height: 100vh;
    padding: 0 24px 40px;
    font-family: "Segoe UI", Arial, sans-serif;
    color: #f3f0ff;
    background:
        radial-gradient(ellipse at top left, rgba(109, 40, 217, 0.20), transparent 40%),
        radial-gradient(ellipse at bottom right, rgba(59, 130, 246, 0.10), transparent 40%),
        #0b0a13;
    line-height: 1.6;
}

/* =========================
   NAVIGATION
========================= */

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 22px 0;
    margin-bottom: 35px;
    border-bottom: 1px solid rgba(167, 139, 250, 0.15);
}

nav a {
    padding: 9px 16px;
    color: #c4bfd8;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 9px;
    transition: background 0.2s ease, color 0.2s ease;
}

nav a:hover {
    color: #ffffff;
    background: rgba(139, 92, 246, 0.18);
}

/* =========================
   HEADINGS AND TEXT
========================= */

h1,
h2,
h3 {
    color: #ffffff;
    line-height: 1.2;
}

h1 {
    margin: 25px 0;
    text-align: center;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 750;
    letter-spacing: -1px;
}

h2 {
    margin-bottom: 12px;
    font-size: 1.6rem;
}

p {
    color: #b7b2c9;
    margin-bottom: 16px;
}

a {
    color: #b69aff;
}

a:hover {
    color: #d6c5ff;
}

/* =========================
   BUTTONS
========================= */

button {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 650;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25);
}

button:active {
    transform: translateY(0);
}

/* =========================
   INPUTS AND FORMS
========================= */

input,
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #373047;
    border-radius: 10px;
    background: #15121f;
    color: #f3f0ff;
    font: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

input[type="checkbox"] {
    width: auto;
    accent-color: #8b5cf6;
}

input[type="date"] {
    color-scheme: dark;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #ddd6f5;
    font-weight: 600;
}

/* =========================
   LOGIN SECTION
========================= */

#login-section {
    width: 100%;
    max-width: 440px;
    margin: 40px auto;
    padding: 30px;
    background: rgba(20, 18, 35, 0.88);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#login-form label {
    margin-bottom: 0;
}

#login-form label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 400;
}

#login-form button {
    margin-top: 8px;
}

#login-message,
#status {
    margin-top: 15px;
}

/* =========================
   LOGOUT BUTTON
========================= */

#logout-button {
    display: block;
    margin: 15px auto;
    background: #24172e;
    border: 1px solid #52336b;
}

#logout-button:hover {
    background: #3b1f4c;
}

/* =========================
   PROJECTS PAGE
========================= */

.projects-hero {
    max-width: 900px;
    margin: 50px auto;
    text-align: center;
}

.projects-label {
    display: inline-block;
    margin-bottom: 12px;
    padding: 6px 12px;
    border: 1px solid rgba(167, 139, 250, 0.25);
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.12);
    color: #c4b5fd;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin: 35px auto;
}

.project-card {
    padding: 25px;
    border: 1px solid #292337;
    border-radius: 16px;
    background: rgba(20, 18, 35, 0.8);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: #7851c9;
}

.project-icon {
    margin-bottom: 15px;
    font-size: 2rem;
}

.project-card h2 {
    font-size: 1.2rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.project-tag {
    padding: 5px 9px;
    border-radius: 7px;
    background: rgba(139, 92, 246, 0.12);
    color: #c4b5fd;
    font-size: 0.8rem;
}

/* =========================
   GUESTBOOK
========================= */

.guestbook-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 750px;
    max-height: 450px;
    overflow-y: auto;
    margin: 25px auto;
    padding: 5px;
    list-style: none;
}

.guestbook-list li {
    padding: 18px;
    background: rgba(20, 18, 35, 0.85);
    border: 1px solid #30283f;
    border-radius: 12px;
    overflow-wrap: anywhere;
}

#guestbook-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 750px;
    margin: 30px auto;
    padding: 25px;
    background: rgba(20, 18, 35, 0.85);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 16px;
}

#guestbook-form input {
    margin-bottom: 10px;
}

#guestbook-form textarea {
    min-height: 130px;
    resize: vertical;
}

#guestbook-form button {
    align-self: flex-start;
    margin-top: 8px;
}

#form-error {
    max-width: 750px;
    margin: 15px auto;
    color: #fca5a5;
}

#form-error:empty {
    display: none;
}

/* =========================
   SPACE PICTURE OF THE DAY
========================= */

#space-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 520px;
    margin: 30px auto;
    padding: 25px;
    background: rgba(20, 18, 35, 0.88);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 18px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.2);
}

#space-form label {
    margin-bottom: 0;
}

#space-form input[type="date"] {
    min-height: 46px;
}

#space-form button {
    margin-top: 5px;
}

#status {
    width: 100%;
    max-width: 850px;
    margin: 20px auto;
    text-align: center;
    color: #c4b5fd;
}

#result {
    width: 100%;
    max-width: 1000px;
    margin: 35px auto;
    padding: clamp(20px, 4vw, 35px);
    background: rgba(20, 18, 35, 0.9);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: fadeUp 0.4s ease;
}

#result h2 {
    margin-bottom: 12px;
    font-size: clamp(1.4rem, 3vw, 2rem);
    overflow-wrap: anywhere;
}

#date-shown {
    margin-bottom: 22px;
    color: #a78bfa;
    font-size: 0.95rem;
}

#picture {
    display: block;
    width: 100%;
    max-height: 650px;
    margin: 20px auto 25px;
    object-fit: contain;
    background: #090811;
    border: 1px solid #30283f;
    border-radius: 14px;
}

#description {
    color: #c4bfd5;
    font-size: 1rem;
    line-height: 1.9;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

#nasa-link {
    display: inline-block;
    margin-top: 12px;
    color: #c4b5fd;
    font-weight: 650;
    text-decoration: none;
}

#nasa-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* =========================
   DASHBOARD
========================= */

.dashboard-card {
    max-width: 850px;
    margin: 35px auto;
    padding: 30px;
    background: rgba(20, 18, 35, 0.85);
    border: 1px solid #30283f;
    border-radius: 16px;
}

/* =========================
   404 ERROR PAGE
========================= */

.error-page {
    min-height: calc(100vh - 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}

.error-card {
    width: 100%;
    max-width: 600px;
    padding: 50px 30px;
    text-align: center;
    background: rgba(20, 18, 35, 0.85);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.error-code {
    display: block;
    margin-bottom: 15px;
    color: #8b5cf6;
    font-size: clamp(4rem, 12vw, 7rem);
    font-weight: 800;
    line-height: 1;
}

.error-home-button {
    display: inline-block;
    margin-top: 12px;
    padding: 12px 24px;
    border-radius: 10px;
    background: #8b5cf6;
    color: #ffffff;
    font-weight: 650;
    text-decoration: none;
    transition: 0.2s ease;
}

.error-home-button:hover {
    background: #7c3aed;
    color: #ffffff;
    transform: translateY(-2px);
}

/* =========================
   SCROLLBARS
========================= */

* {
    scrollbar-width: thin;
    scrollbar-color: #574078 #15121f;
}

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: #15121f;
}

::-webkit-scrollbar-thumb {
    background: #574078;
    border-radius: 10px;
}

/* =========================
   ANIMATIONS
========================= */

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   RESPONSIVE DESIGN
========================= */

@media (max-width: 600px) {
    body {
        padding: 0 15px 30px;
    }

    nav {
        gap: 4px;
        margin-bottom: 25px;
    }

    nav a {
        padding: 8px 10px;
        font-size: 0.88rem;
    }

    h1 {
        margin: 20px 0;
    }

    #space-form,
    #guestbook-form,
    #login-section {
        padding: 20px;
    }

    #result {
        padding: 18px;
    }

    #picture {
        max-height: 450px;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .error-card {
        padding: 40px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}