/* Reset en basis styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(96, 165, 250, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(167, 139, 250, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(244, 114, 182, 0.1) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(5deg); }
    66% { transform: translate(-20px, 20px) rotate(-5deg); }
}

.container {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
}

/* Auth Card */
.auth-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.9));
    backdrop-filter: blur(25px) saturate(180%);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 8px 16px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    position: relative;
    z-index: 1;
}

/* Header */
.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 10px;
}

.logo .logo-image {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    filter: drop-shadow(0 4px 12px rgba(96, 165, 250, 0.5));
    animation: robotFloat 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

.logo .logo-image:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 16px rgba(96, 165, 250, 0.6));
}

.logo i {
    font-size: 2.5rem;
    color: #60a5fa;
    filter: drop-shadow(0 4px 12px rgba(96, 165, 250, 0.5));
    animation: robotFloat 3s ease-in-out infinite;
}

@keyframes robotFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(5deg); }
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #f1f5f9;
    position: relative;
    background: linear-gradient(90deg, 
        #60a5fa 0%, 
        #a78bfa 25%, 
        #60a5fa 50%, 
        #a78bfa 75%, 
        #60a5fa 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 100%;
    animation: shinyText 6s linear infinite;
    animation-delay: calc(-1s * (var(--anim-offset, 0)));
    filter: drop-shadow(0 2px 6px rgba(96, 165, 250, 0.3));
}

.logo h1::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        transparent 40%,
        rgba(255, 255, 255, 0.9) 50%, 
        transparent 60%,
        transparent 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 100%;
    animation: shinySlide 4s linear infinite;
    animation-delay: calc(-1s * (var(--anim-offset, 0)));
    pointer-events: none;
}

@keyframes shinyText {
    from {
        background-position: 0% 50%;
    }
    to {
        background-position: 200% 50%;
    }
}

@keyframes shinySlide {
    from {
        background-position: 0% 50%;
    }
    to {
        background-position: 200% 50%;
    }
}

.subtitle {
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 500;
}

/* Tabs */
.auth-tabs {
    display: flex;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 6px;
    margin-bottom: 30px;
    gap: 6px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    background: transparent;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
}

.tab-btn:hover {
    color: #e2e8f0;
    background: rgba(96, 165, 250, 0.1);
    transform: translateY(-1px);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.25), rgba(167, 139, 250, 0.25));
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(96, 165, 250, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

/* Forms */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #e2e8f0;
    font-size: 0.95rem;
}

.form-group label i {
    color: #60a5fa;
    width: 18px;
    font-size: 1rem;
}

.form-group input {
    width: 100%;
    padding: 16px 18px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(30, 41, 59, 0.6);
    color: #f1f5f9;
    backdrop-filter: blur(10px);
    font-family: 'Inter', sans-serif;
}

.form-group input::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

.form-group input:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.5);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15),
                0 4px 12px rgba(96, 165, 250, 0.2);
    transform: translateY(-1px);
}

.form-group input:invalid {
    border-color: #e53e3e;
}

.password-input {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.toggle-password i {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.toggle-password:hover {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: #94a3b8;
    font-size: 0.8rem;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 18px 28px;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
    color: white;
    box-shadow: 0 10px 25px rgba(96, 165, 250, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(96, 165, 250, 0.5),
                0 8px 18px rgba(167, 139, 250, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(96, 165, 250, 0.4);
}

/* Alerts */
.alert {
    padding: 18px 20px;
    border-radius: 14px;
    margin: 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.alert-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.1));
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: linear-gradient(135deg, rgba(56, 178, 172, 0.15), rgba(45, 212, 191, 0.1));
    color: #5eead4;
    border: 1px solid rgba(56, 178, 172, 0.3);
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.auth-footer p {
    color: rgba(148, 163, 184, 0.8);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    line-height: 1.7;
    font-weight: 400;
}

.auth-footer i {
    color: #60a5fa;
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 2px;
    filter: drop-shadow(0 2px 4px rgba(96, 165, 250, 0.3));
}

/* Responsive */
/* Large screens */
@media (min-width: 1200px) {
    .container {
        max-width: 500px;
    }
    
    .auth-card {
        padding: 50px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .container {
        max-width: 100%;
    }
    
    .auth-card {
        padding: 35px 30px;
        margin: 0;
    }
    
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .logo i {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .form-group input {
        padding: 13px 15px;
        font-size: 0.95rem;
    }
    
    .btn {
        padding: 15px 22px;
        font-size: 0.95rem;
    }
    
    .modal-content {
        width: 92%;
        margin: 3% auto;
    }
}

/* Mobile devices */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    .auth-card {
        padding: 28px 22px;
        border-radius: 20px;
    }
    
    .auth-header {
        margin-bottom: 25px;
    }
    
    .logo {
        gap: 12px;
    }
    
    .logo h1 {
        font-size: 1.6rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .auth-tabs {
        padding: 3px;
        margin-bottom: 25px;
    }
    
    .tab-btn {
        padding: 11px 18px;
        font-size: 0.85rem;
        gap: 6px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }
    
    .form-group input {
        padding: 12px 14px;
        font-size: 0.9rem;
        border-radius: 10px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 0.9rem;
        border-radius: 10px;
    }
    
    .alert {
        padding: 14px;
        font-size: 0.9rem;
        margin: 18px 0;
    }
    
    .auth-footer {
        margin-top: 25px;
        padding-top: 18px;
    }
    
    .auth-footer p {
        font-size: 0.85rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 5px;
        max-height: calc(100vh - 20px);
    }
    
    .modal-header {
        padding: 18px 24px;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 24px 20px;
    }
    
    .modal-body p {
        font-size: 1rem;
    }
    
    .modal-footer {
        padding: 18px 24px;
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    body {
        padding: 10px;
    }
    
    .auth-card {
        padding: 24px 18px;
    }
    
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .logo i {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .tab-btn {
        padding: 10px 14px;
        font-size: 0.8rem;
    }
    
    .form-group input {
        padding: 11px 13px;
    }
    
    .btn {
        padding: 13px 18px;
        font-size: 0.85rem;
    }
}

/* Landscape mode for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 10px;
    }
    
    .auth-card {
        padding: 25px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .auth-header {
        margin-bottom: 20px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .auth-tabs {
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .auth-footer {
        margin-top: 20px;
        padding-top: 15px;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .tab-btn,
    .toggle-password,
    .modal-close {
        min-height: 44px;
        min-width: 44px;
    }
    
    .tab-btn:active {
        transform: scale(0.98);
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    /* Prevent text selection on buttons */
    .btn,
    .tab-btn {
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Better scrolling */
    .auth-card,
    .modal-content {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body::before {
        animation: none !important;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo i,
    .modal-icon i {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .auth-card {
        padding: 30px 20px;
        margin: 10px;
    }
    
    .logo h1 {
        font-size: 1.6rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .tab-btn {
        padding: 10px 16px;
        font-size: 0.8rem;
    }
    
    .form-group input {
        padding: 12px 14px;
    }
    
    .btn {
        padding: 14px 20px;
    }
}

/* Loading state */
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    color: white;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.6), rgba(167, 139, 250, 0.6));
    border-radius: 10px;
    border: 2px solid rgba(15, 23, 42, 0.5);
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.8), rgba(167, 139, 250, 0.8));
}

::-webkit-scrollbar-corner {
    background: rgba(15, 23, 42, 0.5);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 165, 250, 0.6) rgba(15, 23, 42, 0.5);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    }
    
    .auth-card {
        background: rgba(45, 55, 72, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .logo h1 {
        color: #f7fafc;
    }
    
    .subtitle {
        color: #a0aec0;
    }
    
    .auth-tabs {
        background: #2d3748;
    }
    
    .tab-btn {
        color: #a0aec0;
    }
    
    .tab-btn:hover {
        color: #e2e8f0;
    }
    
    .tab-btn.active {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .form-group label {
        color: #e2e8f0;
    }
    
    .form-group input {
        background: #4a5568;
        border-color: #4a5568;
        color: #f7fafc;
    }
    
    .form-group input:focus {
        background: #2d3748;
        border-color: #667eea;
    }
    
    .form-hint {
        color: #a0aec0;
    }
    
    .auth-footer {
        border-top-color: #4a5568;
    }
    
    .auth-footer p {
        color: #a0aec0;
    }
}

/* Modal Popup Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 24px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5),
                0 10px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

.modal-header {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.3), rgba(167, 139, 250, 0.3));
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
    text-align: center;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.modal-icon.success {
    color: #48bb78;
}

.modal-icon.error {
    color: #e53e3e;
}

.modal-icon.info {
    color: #4299e1;
}

.modal-body p {
    font-size: 1.1rem;
    color: #cbd5e1;
    line-height: 1.6;
    margin: 0;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 80px;
}

.modal-footer .btn-secondary {
    background: rgba(51, 65, 85, 0.7);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.modal-footer .btn-secondary:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: rgba(148, 163, 184, 0.4);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}