* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #dcc4ad;
    --primary-dark: #bfaa97;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: visible;
    animation: fadeInUp 0.6s ease-out;
    position: relative;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
}

.login-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.language-dropdown {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 100;
}

.language-current {
    width: 50px;
    height: 38px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
}

.language-current:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.language-current img {
    width: 38px;
    height: 25px;
    object-fit: cover;
    border-radius: 4px;
}

.language-current::after {
    content: '\f078';
    font-family: 'Font Awesome 7 Pro';
    font-weight: 900;
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--primary);
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.language-dropdown.active .language-current::after {
    transform: rotate(180deg);
}

.language-options {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    padding: 8px;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.language-dropdown.active .language-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-option:hover {
    background: var(--gray-50);
}

.language-option.active {
    background: rgba(220, 196, 173, 0.1);
}

.language-option img {
    width: 32px;
    height: 21px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.language-option-text {
    font-size: 14px;
    color: var(--gray-900);
    font-weight: 500;
}

.language-option.active .language-option-text {
    color: var(--primary-dark);
    font-weight: 600;
}

.language-option-check {
    margin-left: auto;
    color: var(--primary);
    font-size: 14px;
    opacity: 0;
}

.language-option.active .language-option-check {
    opacity: 1;
}

.logo-icon {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
    overflow: hidden;
    padding: 4px;
}

.logo-icon i {
    font-size: 40px;
    color: var(--primary);
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.login-header h1 {
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.login-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    position: relative;
    z-index: 1;
}

.login-body {
    padding: 40px 30px;
}

.welcome-text {
    text-align: center;
    margin-bottom: 30px;
}

.welcome-text h2 {
    font-size: 24px;
    color: var(--gray-900);
    margin-bottom: 8px;
    font-weight: 600;
}

.welcome-text p {
    color: var(--gray-600);
    font-size: 15px;
    line-height: 1.5;
}

.login-method {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.method-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

.method-icon i {
    font-size: 28px;
    color: white;
}

.method-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.method-description {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 20px;
    line-height: 1.4;
}

.telegram-widget-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50px;
}

.login-footer {
    padding: 20px 30px;
    background: var(--gray-50);
    text-align: center;
    border-top: 1px solid var(--gray-200);
    border-radius: 0 0 20px 20px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--gray-600);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-link:hover {
    color: var(--primary);
}

.footer-link i {
    font-size: 12px;
}

.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /*margin-top: 16px;*/
    color: var(--gray-600);
    font-size: 12px;
}

.security-badge i {
    color: var(--primary);
    font-size: 16px;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .login-container {
        border-radius: 16px;
    }

    .login-header {
        border-radius: 16px 16px 0 0;
    }

    .login-footer {
        border-radius: 0 0 16px 16px;
    }

    .language-dropdown {
        top: 12px;
        right: 12px;
    }

    .language-current {
        width: 46px;
        height: 34px;
    }

    .language-current img {
        width: 34px;
        height: 22px;
    }

    .language-options {
        min-width: 140px;
    }

    .login-header {
        padding: 32px 24px;
    }

    .logo-icon {
        width: 70px;
        height: 70px;
        margin-bottom: 16px;
        padding: 3px;
    }

    .logo-icon i {
        font-size: 36px;
    }

    .logo-icon img {
        border-radius: 14px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .login-header p {
        font-size: 14px;
    }

    .login-body {
        padding: 32px 24px;
    }

    .welcome-text h2 {
        font-size: 20px;
    }

    .welcome-text p {
        font-size: 14px;
    }

    .login-method {
        padding: 20px;
    }

    .method-icon {
        width: 54px;
        height: 54px;
    }

    .method-icon i {
        font-size: 24px;
    }

    .login-footer {
        padding: 16px 24px;
    }

    .footer-links {
        flex-direction: column;
        gap: 12px;
    }
}

/* iPhone 5 and very small screens */
@media (max-width: 320px) {
    .language-dropdown {
        top: 10px;
        right: 10px;
    }

    .language-current {
        width: 42px;
        height: 30px;
    }

    .language-current img {
        width: 30px;
        height: 20px;
    }

    .login-header {
        padding: 24px 16px;
    }

    .logo-icon {
        width: 60px;
        height: 60px;
        padding: 3px;
    }

    .logo-icon i {
        font-size: 30px;
    }

    .logo-icon img {
        border-radius: 12px;
    }

    .login-header h1 {
        font-size: 20px;
    }

    .login-body {
        padding: 24px 16px;
    }

    .welcome-text {
        margin-bottom: 24px;
    }

    .welcome-text h2 {
        font-size: 18px;
    }

    .login-method {
        padding: 16px;
    }

    .login-footer {
        padding: 12px 16px;
    }
}

/* Loading animation for Telegram widget */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.telegram-widget-container:empty::after {
    content: 'Loading...';
    color: var(--gray-600);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Backdrop for dropdown */
.dropdown-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99;
    display: none;
}

.language-dropdown.active ~ .dropdown-backdrop {
    display: block;
}