/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font);
    background:
        radial-gradient(circle at 16% 10%, rgba(0, 146, 135, 0.18), transparent 30%),
        radial-gradient(circle at 82% 12%, rgba(174, 216, 255, 0.10), transparent 28%),
        var(--body-bg);
    color: var(--body-text);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

/* === MAIN CONTENT === */
.main-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.main-content::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at center, #000 0%, transparent 72%);
    pointer-events: none;
}

/* === CARD === */
.card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 46%),
        var(--block-bg);
    border: 1px solid var(--block-stroke);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* === TYPOGRAPHY === */
.heading-xl {
    font-size: 32px;
    font-weight: 700;
    color: var(--heading-text);
    line-height: 1.2;
}

.heading-lg {
    font-size: 22px;
    font-weight: 600;
    color: var(--heading-text);
    line-height: 1.3;
}

.text-secondary {
    color: var(--secondary-text);
    font-size: 14px;
}

/* === FORM ELEMENTS === */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--body-text);
}

.input-field {
    height: var(--btn-height);
    padding: 0 16px;
    font-size: 15px;
    font-family: var(--font);
    color: var(--heading-text);
    background: color-mix(in srgb, var(--block-bg-faded) 92%, transparent);
    border: 1px solid var(--block-stroke);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s ease, background-color 0.3s ease, box-shadow 0.2s ease;
}

.input-field::placeholder {
    color: var(--secondary-text);
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 146, 135, 0.14);
}

.input-field.error {
    border-color: var(--wrong-text);
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-field {
    width: 100%;
    padding-right: 48px;
}

.input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-text);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
}

.input-icon:hover {
    color: var(--body-text);
}

/* === BUTTONS === */
.btn-primary {
    height: var(--btn-height);
    padding: 0 24px;
    font-size: 16px;
    font-weight: 500;
    font-family: var(--font);
    color: #FFFFFF;
    background: var(--primary-gradient);
    border: none;
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 16px 30px rgba(0, 146, 135, 0.22);
    transition: opacity 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-primary:hover {
    opacity: 0.9;
    box-shadow: 0 18px 36px rgba(0, 146, 135, 0.28);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    height: var(--btn-height);
    padding: 0 24px;
    font-size: 16px;
    font-weight: 500;
    font-family: var(--font);
    color: var(--heading-text);
    background: var(--block-bg);
    border: 1px solid var(--block-stroke);
    border-radius: 18px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-secondary:hover {
    border-color: var(--primary);
    background: var(--block-bg-faded);
}

.btn-secondary:active {
    transform: scale(0.98);
}

/* === DIVIDER === */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--block-stroke);
}

.divider span {
    font-size: 13px;
    color: var(--secondary-text);
    white-space: nowrap;
}

/* === ERROR BANNER === */
.error-banner {
    background: var(--wrong-bg);
    border: 1px solid var(--wrong-stroke);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--wrong-text);
    font-size: 14px;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 8px;
    animation: slideUp 0.3s ease;
}

.error-banner.visible {
    display: flex;
}

/* === LINK === */
.link {
    color: var(--primary-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.link:hover {
    color: var(--primary-hover);
}

/* === SPINNER === */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* === THEME TOGGLE === */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: var(--block-bg);
    border: 1px solid var(--block-stroke);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--body-text);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .icon-sun {
    display: block;
}
[data-theme="dark"] .icon-moon {
    display: none;
}
[data-theme="light"] .icon-sun {
    display: none;
}
[data-theme="light"] .icon-moon {
    display: block;
}

/* === ANIMATIONS === */
@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* === RESPONSIVE === */
@media (max-width: 480px) {
    .card {
        padding: 24px;
    }

    .heading-xl {
        font-size: 26px;
    }
}
