@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
    --primary-color: #4A90E2;
    --background: #1A1B1F;
    --text-color: #ffffff;
    --button-bg: rgba(24, 25, 29, 0.7);
    --button-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    min-height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    position: relative;
}

header {
    text-align: center;
    padding: 1rem 0;
    position: relative;
    z-index: 10;
}

.logo {
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-color);
    font-family: 'TESLA', sans-serif;
}

.logo span {
    color: var(--primary-color);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2rem;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 120px;
    position: relative;
}

.ai-face {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    margin: 0 auto;
    position: relative;
}

.face-dots {
    width: 100%;
    height: 100%;
    position: relative;
}

.chat-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.message {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    text-align: center;
}

.buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.button {
    width: 100%;
    padding: 1rem;
    font-size: clamp(0.875rem, 3vw, 1rem);
    white-space: normal;
    height: auto;
    min-height: 3rem;
    background: rgba(24, 25, 29, 0.7);
    color: var(--text-color);
    border: 1px solid #ccff00;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    min-width: 200px;
    font-weight: 500;
    box-shadow: 0 4px 12px #ccff00;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    animation: buttonAppear 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;

    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(
            45deg,
            transparent,
            rgba(74, 144, 226, 0.1),
            transparent
        );
        transform: translateX(-100%);
        animation: buttonGlow 1.5s ease-out forwards;
        pointer-events: none;
    }
}

.button:hover {
    background: rgba(74, 144, 226, 0.1);
    border-color: rgba(74, 144, 226, 0.5);
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.2);
    transform: translateY(-2px);
}

.progress-bar {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: none;
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 27, 31, 0.9);
    padding: 15px 10px 25px 10px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    z-index: 100;
}

.progress-dots {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
    padding: 0 12px;
}

.progress-dots::before {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    top: 50%;
    transform: translateY(-50%);
    z-index: -1;
}

.progress-dots::after {
    content: '';
    position: absolute;
    left: 16px;
    height: 2px;
    background: var(--primary-color);
    top: 50%;
    transform: translateY(-50%);
    z-index: -1;
    transition: width 0.3s ease;
    width: calc((100% - 32px) * var(--progress-width, 0));
}

.dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
    position: relative;
    margin: 0 5px;
    z-index: 1;
}

.dot.active {
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.dot::after {
    content: attr(data-step);
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    width: 20px;
    text-align: center;
}

footer {
    text-align: center;
    padding: 1rem 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background);
    z-index: 99;
    font-size: 0.9rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    
    .message {
        font-size: 1.1rem;
    }
    
    .ai-face {
        max-width: 300px;
    }
    
    .button {
        padding: 10px 30px;
        font-size: 0.95rem;
    }
    
    .progress-bar {
        width: calc(100% - 32px);
        padding: 12px 8px 20px 8px;
    }
    
    .progress-dots {
        padding: 0 10px;
    }
    
    .progress-dots::before {
        left: 10px;
        right: 10px;
    }
    
    .progress-dots::after {
        left: 10px;
    }
    
    .dot {
        width: 6px;
        height: 6px;
        min-width: 6px;
        margin: 0 8px;
    }
    
    .dot::after {
        font-size: 0.65rem;
        top: 12px;
        width: 16px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.25rem;
    }
    
    .message {
        font-size: 1rem;
    }
    
    .ai-face {
        max-width: 250px;
    }
    
    .buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .button {
        min-width: 280px;
        padding: 14px 30px;
    }
}

.survey-form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    background: rgba(28, 29, 33, 0.5);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.form-field {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
}

.form-field input {
    width: 100%;
    padding: 0.75rem;
    font-size: clamp(0.875rem, 3vw, 1rem);
    background: rgba(24, 25, 29, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.form-field input:focus {
    border-color: var(--primary-color);
    outline: none;
    background: rgba(24, 25, 29, 0.9);
}

.country-code {
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: rgba(24, 25, 29, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    white-space: nowrap;
    min-width: 85px;
    justify-content: center;
    font-size: 0.95rem;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.form-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    appearance: none;
    background: rgba(24, 25, 29, 0.7);
    position: relative;
}

.form-checkbox input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.form-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.submit-button {
    width: 100%;
    margin-top: 1.8rem;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 500;
    background: rgba(24, 25, 29, 0.95);
    color: var(--text-color);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(74, 144, 226, 0.15);
}

.submit-button:hover {
    background: rgba(74, 144, 226, 0.1);
    border-color: rgba(74, 144, 226, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(74, 144, 226, 0.25);
}

.submit-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(74, 144, 226, 0.2),
        transparent
    );
    transition: 0.5s;
}

.submit-button:hover::before {
    left: 100%;
    transition: 0.7s;
}

.submit-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.15);
}

@font-face {
    font-family: 'TESLA';
    src: url('../fonts/TESLA.ttf') format('truetype');
}

.powered-by {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #ffffff;
}

.powered-by span {
    font-family: 'TESLA', sans-serif;
    color: #ffffff;
}

.form-header {
    text-align: center;
    margin-bottom: 25px;
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
}

.step-heading {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 0.7rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
}

.step-message {
    font-size: clamp(0.7rem, 3.7vw, 1.25rem);
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
}

.loading-animation {
    display: inline-block;
    position: relative;
    width: 40px;
    height: 20px;
}

.loading-animation::after {
    content: '...';
    position: absolute;
    left: 0;
    top: -5px;
    font-size: 20px;
    letter-spacing: 2px;
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% { content: '.'; }
    40%, 60% { content: '..'; }
    80%, 100% { content: '...'; }
}

@keyframes calculateBorderSpin {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

.button.calculating {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button.calculating::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(
        90deg, 
        rgba(74, 144, 226, 0.1),
        rgba(74, 144, 226, 0.6),
        rgba(74, 144, 226, 0.9),
        rgba(74, 144, 226, 0.6),
        rgba(74, 144, 226, 0.1)
    );
    background-size: 200% 100%;
    border-radius: 14px;
    animation: calculateBorderSpin 5s linear infinite;
    z-index: -1;
}

.button.calculating::after {
    content: '';
    position: absolute;
    inset: 1px;
    background: var(--button-bg);
    border-radius: 11px;
    z-index: -1;
}

@keyframes buttonAppear {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.button:nth-child(1) { animation-delay: 0.1s; }
.button:nth-child(2) { animation-delay: 0.2s; }
.button:nth-child(3) { animation-delay: 0.3s; }
.button:nth-child(4) { animation-delay: 0.4s; }

@keyframes buttonGlow {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

#sphere-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#sphere-container canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100% !important;
    height: 100% !important;
}

/* Добавляем стили для начального экрана */
.initial-screen .step-heading {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(45deg, var(--primary-color), #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeIn 1s ease-out;
}

.initial-screen .button {
    font-size: 1.5rem;
    padding: 1rem 3rem;
    background: linear-gradient(45deg, var(--primary-color), #2563eb);
    border: none;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.initial-screen .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

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

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 360px) {
    .progress-bar {
        width: calc(100% - 24px);
        bottom: 45px;
        padding: 12px 8px 20px 8px;
    }

    footer {
        height: 45px;
        font-size: 0.8rem;
    }

    .dot {
        width: 6px;
        height: 6px;
        min-width: 6px;
    }

    .progress-dots::before,
    .progress-dots::after {
        left: 3px;
        right: 3px;
    }
}

/* Обеспечиваем отступ для контента */
main {
    padding-bottom: 120px;
    min-height: calc(100vh - 60px);
}

@media (max-width: 768px) {
    main {
        padding-bottom: 100px;
        min-height: calc(100vh - 50px);
    }
}