/* Определение переменных для тем */
:root {
    /* Темная тема (по умолчанию) */
    --body-bg-start: #0a0a0a;
    --body-bg-end: #1c1c1c;
    --card-bg: rgba(31, 31, 31, 0.75);
    --card-border: rgba(50, 50, 50, 0.8);
    --card-shadow: rgba(0, 0, 0, 0.6);
    --text-color: #e0e0e0;
    --subtitle-color: #a0a0a0;
    --heading-shadow: rgba(255, 255, 255, 0.3);
    --avatar-border: #00ffff;
    --avatar-shadow: rgba(0, 255, 255, 0.4), rgba(0, 255, 255, 0.2);
    --button-shadow: rgba(0, 0, 0, 0.4);
    --button-hover-border: rgba(255, 255, 255, 0.2);
    --particles-color: ["#00ffff", "#ff00ff", "#ffea00"];
    --particles-line-color: #444444;

    --tiktok-bg: linear-gradient(45deg, #ff0050, #e6005c);
    --discord-bg: linear-gradient(45deg, #5865f2, #7289da);
    --telegram-bg: linear-gradient(45deg, #0088cc, #00acee);
    --x-bg: linear-gradient(45deg, #000, #333);
}

/* Светлая тема */
body.light-theme {
    --body-bg-start: #f0f0f0;
    --body-bg-end: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(220, 220, 220, 0.8);
    --card-shadow: rgba(0, 0, 0, 0.15);
    --text-color: #333333;
    --subtitle-color: #666666;
    --heading-shadow: rgba(0, 0, 0, 0.1);
    --avatar-border: #cccccc;
    --avatar-shadow: rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.05);
    --button-shadow: rgba(0, 0, 0, 0.1);
    --button-hover-border: rgba(180, 180, 180, 0.5);
    --particles-color: ["#888888", "#aaaaaa", "#cccccc"];
    --particles-line-color: #bbbbbb;

    --tiktok-bg: #ff4081;
    --discord-bg: #7986cb;
    --telegram-bg: #4fc3f7;
    --x-bg: #000000;
}

/* --- НОВЫЕ ТЕМЫ --- */

/* Тема: Лес */
body.theme-forest {
    --body-bg-start: #0F2027;
    --body-bg-end: #203A43;
    --card-bg: rgba(15, 32, 39, 0.8);
    --card-border: rgba(99, 115, 107, 0.8);
    --text-color: #E0E0E0;
    --subtitle-color: #BDBDBD;
    --heading-shadow: rgba(147, 169, 143, 0.3);
    --avatar-border: #588157;
    --avatar-shadow: rgba(88, 129, 87, 0.4), rgba(88, 129, 87, 0.2);
    --particles-color: ["#588157", "#A3B18A", "#DAD7CD"];
    --particles-line-color: #3A5A40;
}

/* Тема: Океан */
body.theme-ocean {
    --body-bg-start: #001f3f;
    --body-bg-end: #004c7a;
    --card-bg: rgba(0, 59, 70, 0.8);
    --card-border: rgba(7, 87, 91, 0.8);
    --text-color: #E0FBFC;
    --subtitle-color: #98C1D9;
    --heading-shadow: rgba(102, 165, 173, 0.3);
    --avatar-border: #3D5A80;
    --avatar-shadow: rgba(61, 90, 128, 0.4), rgba(61, 90, 128, 0.2);
    --particles-color: ["#98C1D9", "#EEFBFB", "#3D5A80"];
    --particles-line-color: #293241;
}

/* Тема: Синтвейв */
body.theme-synthwave {
    --body-bg-start: #1A0929;
    --body-bg-end: #2C003E;
    --card-bg: rgba(26, 9, 41, 0.8);
    --card-border: rgba(221, 0, 255, 0.4);
    --text-color: #F0E6FF;
    --subtitle-color: #A499B3;
    --heading-shadow: rgba(0, 240, 255, 0.3);
    --avatar-border: #DD00FF;
    --avatar-shadow: rgba(221, 0, 255, 0.4), rgba(0, 240, 255, 0.2);
    --particles-color: ["#DD00FF", "#00F0FF", "#FF40A1"];
    --particles-line-color: #FF00C7;
}


body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--body-bg-start), var(--body-bg-end));
    color: var(--text-color);
    overflow: hidden;
    position: relative;
    transition: background 0.5s ease, color 0.5s ease;
}

#glow-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

.container {
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
    max-width: 420px;
    z-index: 2;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.profile-card {
    background-color: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 15px 40px var(--card-shadow);
    border: 1px solid var(--card-border);
    opacity: 0; /* Начальная прозрачность для анимации */
    animation: fadeInCard 1s ease-out forwards;
    position: relative;
    transition: background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--avatar-border);
    margin-bottom: 15px;
    box-shadow: 0 0 25px var(--avatar-shadow);
    opacity: 0; /* Начальная прозрачность для анимации */
    animation: zoomIn 0.8s ease-out forwards;
    animation-delay: 0.3s;
    transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

h1 {
    font-size: 2.5em;
    margin-top: 0;
    margin-bottom: 10px; /* Уменьшил отступ для подзаголовка */
    color: var(--text-color);
    letter-spacing: 2px;
    text-shadow: 0 0 15px var(--heading-shadow);
    opacity: 0; /* Начальная прозрачность для анимации */
    animation: fadeInDown 0.8s ease-out forwards;
    animation-delay: 0.6s;
    transition: color 0.5s ease, text-shadow 0.5s ease;
}

.subtitle {
    font-size: 1.1em;
    color: var(--subtitle-color);
    margin-top: 0;
    margin-bottom: 30px;
    letter-spacing: 1px;
    opacity: 0; /* Начальная прозрачность для анимации */
    animation: fadeInDown 0.8s ease-out forwards;
    animation-delay: 0.8s; /* Появляется чуть позже заголовка */
    transition: color 0.5s ease;
}


.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.social-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 8px 25px var(--button-shadow);
    position: relative;
    overflow: hidden;
    z-index: 0;
    opacity: 0; /* Начальная прозрачность для анимации */
    transform: scale(0.9); /* Начальный размер для анимации */
    animation: scaleIn 0.5s ease-out forwards;
}

.social-button:nth-child(1) { animation-delay: 1.0s; }
.social-button:nth-child(2) { animation-delay: 1.1s; }
.social-button:nth-child(3) { animation-delay: 1.2s; }
.social-button:nth-child(4) { animation-delay: 1.3s; }


.social-button i {
    margin-right: 12px;
    font-size: 1.4em;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.tiktok { background: var(--tiktok-bg); }
.discord { background: var(--discord-bg); }
.telegram { background: var(--telegram-bg); }
.x { background: var(--x-bg); }

.social-button:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--button-hover-border);
}

.tiktok:hover { box-shadow: 0 0 20px #ff0050, 0 0 40px #ff0050; }
.discord:hover { box-shadow: 0 0 20px #5865f2, 0 0 40px #5865f2; }
.telegram:hover { box-shadow: 0 0 20px #0088cc, 0 0 40px #0088cc; }
.x:hover { box-shadow: 0 0 20px #333, 0 0 40px #555; }

/* --- СТИЛИ ДЛЯ ПЕРЕКЛЮЧАТЕЛЕЙ ТЕМ --- */

.top-right-controls {
    position: absolute;
    top: 25px;
    right: 25px;
    display: flex;
    gap: 10px;
    z-index: 100;
    align-items: center;
}

.theme-toggle-corner {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(60, 60, 60, 0.8);
    border: 1px solid rgba(80, 80, 80, 0.5);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #f0f0f0;
    font-size: 1.5em;
    flex-shrink: 0; /* Предотвращает сжатие кнопки */
}

/* --- ИЗМЕНЕННАЯ АНИМАЦИЯ --- */
#theme-toggle {
    /* Плавный переход для трансформации и прозрачности */
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.3s ease-in-out;
}

.theme-toggle-corner:not(#theme-toggle):hover {
    transform: scale(1.1);
}

#theme-toggle:hover {
    transform: scale(1.1);
}

/* Когда активна кастомная тема, применяем эти стили к кнопке светлой/темной темы */
body.custom-theme-active #theme-toggle {
    transform: translateX(25px) scale(0.4); /* Отъезжает вправо и уменьшается */
    opacity: 0;
    pointer-events: none;
}
/* --- КОНЕЦ ИЗМЕНЕНИЙ В АНИМАЦИИ --- */

.light-theme .theme-toggle-corner {
    background-color: rgba(240, 240, 240, 0.8);
    border: 1px solid rgba(200, 200, 200, 0.5);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    color: #333333;
}

.custom-theme-wrapper {
    position: relative;
}

.theme-options {
    position: absolute;
    top: 65px; /* Располагаем под кнопкой */
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: rgba(40, 40, 40, 0.9);
    border: 1px solid rgba(80, 80, 80, 0.7);
    padding: 12px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.light-theme .theme-options {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(200, 200, 200, 0.7);
}


.theme-options.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.theme-choice {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    cursor: pointer;
    background: none;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.light-theme .theme-choice {
    border-color: rgba(0, 0, 0, 0.4);
}

.theme-choice:hover {
    transform: scale(1.15);
    border-color: #00ffff;
}

.theme-choice .swatch {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden; /* Чтобы градиент не вылезал */
}


/* КЛЮЧЕВЫЕ КАДРЫ ДЛЯ АНИМАЦИЙ */
@keyframes fadeInCard {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}


@media (max-width: 600px) {
    .profile-card {
        padding: 30px;
        margin: 15px;
    }

    .avatar {
        width: 110px;
        height: 110px;
    }

    h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }

    .social-button {
        font-size: 1.1em;
        padding: 14px 20px;
    }

    .top-right-controls {
        top: 15px;
        right: 15px;
    }
    
    .theme-toggle-corner {
        width: 45px;
        height: 45px;
        font-size: 1.3em;
    }
    .theme-options {
        top: 60px;
    }
    .theme-choice {
        width: 38px;
        height: 38px;
    }
}