:root {
    --color-primary: #00aaff;
    --color-primary-dark: #005f99;
    --color-primary-light: rgba(0, 170, 255, 0.15);
    --color-text-dark: #fff;
    --color-text-light: #001f33;
    --bg-dark: #08142c;
    --bg-light: #b0d8ff;
    --border-dark: #00aaff22;
    --border-light: rgba(0, 0, 0, 0.1);
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
}

body, html {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Exo 2', sans-serif;
    color: var(--color-text-dark);
    display: flex;
    flex-direction: column;
    transition: background 0.3s, color 0.3s;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url("/img/bg.png") repeat;
    background-size: cover;
    animation: scrollBackground 60s ease-in-out infinite alternate;
    pointer-events: none;
}

/* Light theme */
body.light-theme {
    color: var(--color-text-light);
    background: linear-gradient(to bottom right, #e6f0ff, #cce0ff);
    --color-success: #059669;
    --color-warning: #d97706;
    --color-error: #dc2626;
}

body.light-theme::before {
    opacity: 0.9;
}

/* Header */
header {
    padding: 1rem 2rem;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-dark);
    transition: background 0.3s;
}

body.light-theme header {
    background: var(--bg-light);
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    position: relative;
}

/* Toast - базовые стили */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Exo 2', sans-serif;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Типы toast с использованием ваших переменных */
.toast-info {
    background: var(--color-primary);
    color: var(--color-text-dark);
}

.toast-success {
    background: var(--color-success);
    color: var(--color-text-light)
}

.toast-warning {
    background: var(--color-warning);
    color: var(--color-text-light);
}

.toast-error {
    background: var(--color-error);
    color: var(--color-text-light)
}

/* Иконка (будет работать с Lucide) */
.toast-icon {
    width: 20px;
    height: 20px;
}

/* Адаптив для мобильных */
@media (max-width: 600px) {
    .toast {
        width: 90%;
        padding: 10px 16px;
    }
}

/* Navigation */
.desktop-nav {
    display: flex;
    align-items: center;
    width: 100%;
}

.desktop-info-nav {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.desktop-auth-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.mobile-nav {
    display: none;
}

/* Logo */
.logo {
    font-size: 2rem;
    font-weight: 700;
    padding: 0 0 5px;
    line-height: 1;
    color: var(--color-primary);
    user-select: none;
}

.logo-and-info {
    display: flex;
    align-items: center;
    gap: 0.1rem;
}

/* Links */
nav a {
    color: inherit;
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    transition: background 0.3s, color 0.3s, border-color 0.3s;
    border: 2px solid transparent;
}

nav a[href="#login"],
nav a[href="#register"] {
    border: 2px solid var(--color-primary);
    font-weight: 600;
    padding: 0.4rem 1rem;
}

body.light-theme nav a[href="#login"],
body.light-theme nav a[href="#register"] {
    border-color: var(--color-primary-dark);
    color: var(--color-primary-dark);
}

nav a[href="#login"]:hover,
nav a[href="#register"]:hover {
    background: rgba(0, 170, 255, 0.2);
    border-color: #0077cc;
    color: #0077cc;
}

nav a:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

body.light-theme nav a[href="#login"]:hover,
body.light-theme nav a[href="#register"]:hover {
    background: rgba(0, 95, 153, 0.2);
    border-color: #004d80;
    color: #004d80;
}

/* Theme toggle */
#theme-toggle,
#mobile-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    border-radius: 8px;
    transition: background 0.3s;
    margin-left: 1rem;
}

#theme-toggle:hover,
#mobile-theme-toggle:hover {
    background: var(--color-primary-light);
}

#theme-toggle svg,
#mobile-theme-toggle svg {
    width: 24px;
    height: 24px;
}

/* Main content */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem 1rem 3rem;
    width: 100%;
    box-sizing: border-box;
}

/* Projects */
.projects-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    gap: 20px;
    width: 100%;
    max-width: 1200px;
}

.project-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
}

.project {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s;
    min-width: 250px;
    height: 150px;
    flex: 1 1 calc(33.333% - 40px);
    max-width: 300px;
    background: #1c263b;
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.2);
    will-change: transform;
}

@media (hover: none) {
    .project:hover {
        transform: none !important; /* Отключить hover-эффекты на тач-устройствах */
    }
}

.project:hover {
    transform: scale(1.05);
}

.project img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.6);
    transition: filter 0.3s, transform 0.3s ease;
}

.project:hover img {
    filter: brightness(0.8);
    transform: scale(1.03);
}

body.light-theme .project img {
    filter: brightness(0.8);
}

.overlay-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: #fff;
    font-size: 1.5rem;
    background: rgba(0, 170, 255, 0.8);
    padding: 0.5rem 1rem;
    text-align: center;
}

body.light-theme .overlay-text {
    background: rgba(0, 130, 255, 0.8);
}

/* Адаптация под разное количество проектов */
.project.single {
    flex: 0 1 700px;
    max-width: 700px;
    height: 300px;
    margin: 2rem auto;
}

.project.double {
    flex: 1 1 calc(50% - 40px);
    max-width: 450px;
    height: 250px;
}

.project.triple {
    flex: 1 1 calc(33.333% - 40px);
    max-width: 350px;
    height: 200px;
}

.project.last-center {
    margin: 0 auto;
    max-width: 350px;
    height: 200px;
}

/* Footer */
footer {
    padding: 1rem;
    text-align: center;
    background: var(--bg-dark);
    border-top: 1px solid var(--border-dark);
    transition: background 0.3s;
}

body.light-theme footer {
    background: var(--bg-light);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.footer-container a {
    color: #aaa;
    text-decoration: none;
    margin: 0.5rem 1rem;
}

.footer-container span {
    color: #555;
    margin: 0.5rem 1rem;
}

body.light-theme .footer-container a,
body.light-theme .footer-container span {
    color: #003366;
}

/* Animations */
@keyframes scrollBackground {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Mobile menu */
.burger {
    display: none;
    background: none;
    border: none;
    color: inherit;
    padding: 0.4rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.3s;
}

.burger:hover {
    background: var(--color-primary-light);
}

.nav-popup {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-popup nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1.5rem;
}

@media (min-width: 850px) {
    .desktop-nav {
        display: flex;
    }

    .burger {
        display: none !important;
    }

    .nav-popup {
        display: none;
    }
}

/* Responsive styles */
@media (max-width: 850px) {
    .nav-container {
        justify-content: space-between;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-nav {
        display: flex;
    }

    .info-nav {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        margin-top: 1rem;
    }

    .info-nav a,
    .info-nav a[href="#login"],
    .info-nav a[href="#register"] {
        padding: 0.6rem 0;
        margin: 0;
        width: 100%;
        border: none;
        border-bottom: 1px solid;
        border-color: var(--border-dark);
        border-radius: 0;
        text-align: left;
        font-weight: normal;
    }

    .info-nav a[href="#login"]:hover,
    .info-nav a[href="#register"]:hover {
        background: var(--color-primary-light);
        color: var(--color-primary);
        border-bottom-color: var(--border-dark);
    }

    body.light-theme .info-nav a,
    body.light-theme .info-nav a[href="#login"],
    body.light-theme .info-nav a[href="#register"] {
        border-bottom-color: var(--border-light);
        color: var(--color-text-light);
        font-weight: normal;
    }

    body.light-theme .info-nav a[href="#login"]:hover,
    body.light-theme .info-nav a[href="#register"]:hover {
        background: rgba(0, 95, 153, 0.1);
        color: var(--color-text-light);
        border-bottom-color: var(--border-light);
    }

    #theme-toggle,
    #mobile-theme-toggle {
        order: 1;
    }

    .burger {
        display: flex;
        order: 2;
    }

    .nav-popup {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-dark);
        display: none;
        flex-direction: column;
        padding: 0 2rem 1rem 2rem;
        margin: 1rem 0 0 0;
        border-top: 1px solid var(--border-dark);
        z-index: 99;
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    body.light-theme .nav-popup {
        background: var(--bg-light);
    }

    .nav-container.active .nav-popup {
        display: flex;
        opacity: 0.95;
        transform: translateY(0);
    }

    .nav-popup nav ul {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .nav-popup nav ul li a {
        padding: 0.6rem 0;
        display: block;
        font-size: 1.1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    body.light-theme .nav-popup nav ul li a {
        border-bottom-color: var(--border-light);
    }

    .nav-popup nav ul li:last-child a {
        border-bottom: none;
    }
}

/* Additional mobile optimizations */
@media (max-width: 600px) {
    header {
        padding: 1rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    main {
        padding: 2rem 1rem;
    }

    .project {
        height: 120px;
    }

    .project.single {
        height: 200px;
        max-width: 90%;
    }

    .overlay-text {
        font-size: 1.2rem;
        padding: 0.4rem 0.8rem;
    }

    .footer-container {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 400px) {
    .logo {
        font-size: 1.3rem;
    }

    .project {
        height: 100px;
    }

    .overlay-text {
        font-size: 1rem;
    }
}

/* Snowflakes */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
    animation: fall linear infinite;
    pointer-events: none;
}

@keyframes fall {
    to {
        transform: translateY(100vh);
    }
}

body.light-theme .snowflake {
    opacity: 0.5;
}

/* Общие стили для текстовых страниц */
.terms-container,
.privacy-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    color: var(--color-text-dark);
}

body.light-theme .terms-container,
body.light-theme .privacy-container {
    color: var(--color-text-light);
}

.terms-content,
.privacy-content {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 1rem 2rem;
    backdrop-filter: blur(10px);
}

body.light-theme .terms-content,
body.light-theme .privacy-content {
    background: rgba(255, 255, 255, 0.8);
}

.terms-content h1,
.privacy-content h1 {
    color: var(--color-primary);
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.terms-content h2,
.privacy-content h2 {
    margin-top: 0;
    color: var(--color-primary);
    font-size: 1.5rem;
}

.terms-content h3 {
    margin-top: 1.5rem;
    font-size: 1.2rem;
}

.terms-content p,
.terms-content ul,
.privacy-content p,
.privacy-content ul {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.terms-content ul,
.privacy-content ul {
    padding-left: 1.5rem;
}

.terms-content a,
.privacy-content a {
    color: var(--color-primary);
    text-decoration: none;
}

.terms-content a:hover,
.privacy-content a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .terms-container,
    .privacy-container {
        padding: 1rem;
    }

    .terms-content,
    .privacy-content {
        padding: 1.5rem;
    }
}

@media (max-width: 600px) {
    .terms-content h1,
    .privacy-content h1 {
        font-size: 1.8rem;
    }

    .terms-content h2,
    .privacy-content h2 {
        font-size: 1.3rem;
    }
}

/* Модальные окна - обновленные стили */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1001;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-dark);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: min(90%, 400px);
    color: var(--color-text-dark);
    position: relative;
    border: 1px solid var(--border-dark);
    transform: translateY(-20px);
    transition: transform 0.3s ease, background 0.3s, color 0.3s;
}

.modal.hidden .modal-content {
    transform: translateY(20px);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--color-primary);
    text-align: center;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-content label {
    font-weight: 500;
    font-size: 0.9rem;
}

.modal-content input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-dark);
    background: rgba(0, 0, 0, 0.3);
    color: var(--color-text-dark);
    font-family: 'Exo 2', sans-serif;
    font-size: 1rem;
    transition: all 0.3s;
    box-sizing: border-box;
}

.modal-content input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.modal-content input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

.modal-content button[type="submit"],
.modal-content button[type="button"] {
    padding: 0.8rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.3s ease;
    margin-top: 0.5rem;
}

.modal-content button[type="submit"]:hover,
.modal-content button[type="button"]:hover {
    background: var(--color-primary-dark);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-dark);
    opacity: 0.7;
    transition: opacity 0.3s;
    padding: 0.5rem;
    line-height: 1;
}

.close-btn:hover {
    opacity: 1;
}

/* Light theme styles */
body.light-theme .modal-content {
    background: var(--bg-light);
    color: var(--color-text-light);
    border: 1px solid var(--border-light);
}

body.light-theme .modal-content input {
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-text-light);
    border: 1px solid var(--border-light);
}

body.light-theme .modal-content input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

body.light-theme .modal-content input:focus {
    background: white;
    border-color: var(--color-primary-dark);
    box-shadow: 0 0 0 2px rgba(0, 95, 153, 0.2);
}

body.light-theme .close-btn {
    color: var(--color-text-light);
}

/* Адаптация для мобильных */
@media (max-width: 600px) {
    .modal-content {
        padding: 1.5rem;
    }

    .modal-content h2 {
        font-size: 1.3rem;
    }

    .modal-content input {
        padding: 0.7rem;
    }

    .modal-content button[type="submit"],
    .modal-content button[type="button"] {
        padding: 0.7rem;
    }
}

.checkbox-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.forgot-link {
  text-decoration: none;
  color: var(--color-primary);
}

.forgot-link:hover {
  text-decoration: underline;
}


.privacy-content form {
    max-width: 400px;
    margin: 2rem auto 0;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.privacy-content form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.privacy-content form input[type="email"] {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-dark);
    background: rgba(0, 0, 0, 0.2);
    color: var(--color-text-dark);
    transition: border 0.3s, box-shadow 0.3s;
}

body.light-theme .privacy-content form input[type="email"] {
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-text-light);
    border: 1px solid var(--border-light);
}

.privacy-content .auth-button {
    margin-top: 1rem;
    align-self: center;
    padding: 0.8rem 2rem;
    background: var(--color-primary);
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
    text-align: center;
    display: inline-block;
}

.privacy-content .auth-button:hover {
    background: var(--color-primary-dark);
}

.g-recaptcha {
    margin: 0 auto;
}

.form-group.checkbox-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Стилизация checkbox */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* Дополнительно для светлой темы */
body.light-theme input[type="checkbox"] {
    accent-color: var(--color-primary-dark);
}

/* Стили для reset.ejs: поля пароля */
.privacy-content form input[type="password"] {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-dark);
    background: rgba(0, 0, 0, 0.2);
    color: var(--color-text-dark);
    transition: border 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

body.light-theme .privacy-content form input[type="password"] {
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-text-light);
    border: 1px solid var(--border-light);
}

/* Выровнять кнопку сброса */
.privacy-content form .auth-button {
    margin-top: 1.5rem;
    align-self: center;
    padding: 0.8rem 2rem;
}
