@import url('https://fonts.googleapis.com/css2?family=Questrial&display=swap');

/* --- Общие настройки --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Questrial", sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    transition: background-color 0.3s ease;
}

/* --- Анимации --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes welcomeScale {
    from { 
        opacity: 0; 
        transform: scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Карточка (Login / Signup) --- */
.card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 400px;
    position: relative;
    animation: fadeInUp 0.6s ease-out;
}

/* --- Страница Welcome --- */
.welcome-card {
    background: white;
    padding: 50px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 450px;
    animation: welcomeScale 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- Хедер --- */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    animation: fadeInUp 0.5s ease-out;
}

.logo img {
    height: 32px;
    transition: transform 0.3s ease;
}

.logo:hover img {
    transform: rotate(5deg) scale(1.05);
}

.header-text {
    color: #999;
    font-size: 13px;
}

h1, h2 {
    color: #1a1a1a;
    font-weight: 500;
}

h2 { 
    font-size: 22px; 
    margin-bottom: 25px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

h1 { 
    font-size: 28px; 
    margin: 20px 0 10px; 
}

p { 
    color: #666; 
    margin-bottom: 30px; 
}

/* --- Поля ввода и Анимация --- */
#name-group {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 120px;
    opacity: 1;
    overflow: hidden;
}

#name-group.hidden {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    pointer-events: none;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
}

/* Staggered animations for labels */
label:nth-of-type(1) {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

label:nth-of-type(2) {
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

label:nth-of-type(3) {
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

input {
    width: 100%;
    padding: 14px;
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 16px;
    background: #fcfcfc;
    transition: all 0.3s ease;
}

/* Staggered animations for inputs */
input:nth-of-type(1) {
    animation: fadeInUp 0.6s ease-out 0.25s both;
}

input:nth-of-type(2) {
    animation: fadeInUp 0.6s ease-out 0.35s both;
}

input:nth-of-type(3) {
    animation: fadeInUp 0.6s ease-out 0.45s both;
}

input:focus {
    outline: none;
    border-color: #1a1a1a;
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- Кнопки --- */
button {
    width: 100%;
    padding: 16px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out 0.5s both;
}

button:hover:not(:disabled) {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

/* Ripple effect on button click */
button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::before {
    width: 300px;
    height: 300px;
}

/* Loading state animation */
button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

button:disabled::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.exit-btn {
    background: #f4f4f4;
    color: #666;
    margin-top: 10px;
}

.exit-btn:hover {
    background: #eee;
    color: #1a1a1a;
}

/* --- Дополнительные элементы --- */
.toggle {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
    animation: fadeInUp 0.6s ease-out 0.6s both;
}

.toggle:hover {
    color: #1a1a1a;
}

.family-tag {
    background: #1a1a1a;
    color: white;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 14px;
    display: inline-block;
}

#message {
    margin-top: 15px;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
    transition: all 0.4s ease;
    transform-origin: top;
}

#message.show {
    animation: slideDown 0.4s ease;
}

/* --- Мобильная адаптация --- */
@media (max-width: 480px) {
    body {
        background-color: white;
        align-items: flex-start;
        padding-top: 40px;
    }
    .card, .welcome-card {
        padding: 30px 20px;
        box-shadow: none;
        max-width: 100%;
    }
}
