/* ===========================
   MikroPanel - Login Page CSS
   3D Effects & Animations
   =========================== */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --accent: #f43f5e;
    --bg-dark: #0f172a;
    --bg-card: rgba(15, 23, 42, 0.8);
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glow-primary: 0 0 20px rgba(99, 102, 241, 0.5);
    --glow-secondary: 0 0 20px rgba(14, 165, 233, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    direction: rtl;
}

/* Canvas پس‌زمینه */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ذرات شناور */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: radial-gradient(circle, var(--primary-light), transparent);
    border-radius: 50%;
    opacity: 0.3;
    animation: float-particle linear infinite;
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* کانتینر ورود */
.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    padding: 20px;
    perspective: 1000px;
}

/* کارت ورود - افکت شیشه‌ای */
.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px 35px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 100px rgba(99, 102, 241, 0.1);
    transform-style: preserve-3d;
    animation: cardEntrance 1s ease-out;
    position: relative;
    overflow: hidden;
}

/* افکت نوری گوشه‌ها */
.login-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent,
        var(--primary) 10%,
        transparent 20%,
        transparent,
        var(--secondary) 60%,
        transparent 70%
    );
    animation: rotate-border 8s linear infinite;
    opacity: 0.1;
}

.login-card::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: var(--bg-card);
    border-radius: 22px;
    z-index: 0;
}

.login-card > * {
    position: relative;
    z-index: 1;
}

@keyframes rotate-border {
    to { transform: rotate(360deg); }
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: rotateX(10deg) translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotateX(0) translateY(0) scale(1);
    }
}

/* هدر لاگین */
.login-header {
    text-align: center;
    margin-bottom: 35px;
}

/* لوگوی مکعب سه‌بعدی */
.logo-3d {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    perspective: 200px;
}

.logo-cube {
    width: 60px;
    height: 60px;
    margin: 10px auto;
    position: relative;
    transform-style: preserve-3d;
    animation: cube-rotate 10s ease-in-out infinite;
}

.cube-face {
    position: absolute;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
}

.cube-face.front  { 
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    transform: translateZ(30px); 
}
.cube-face.back   { 
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: rotateY(180deg) translateZ(30px); 
}
.cube-face.right  { 
    background: linear-gradient(135deg, var(--secondary), #0284c7);
    transform: rotateY(90deg) translateZ(30px); 
}
.cube-face.left   { 
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    transform: rotateY(-90deg) translateZ(30px); 
}
.cube-face.top    { 
    background: linear-gradient(135deg, #10b981, #059669);
    transform: rotateX(90deg) translateZ(30px); 
}
.cube-face.bottom { 
    background: linear-gradient(135deg, #f59e0b, #d97706);
    transform: rotateX(-90deg) translateZ(30px); 
}

@keyframes cube-rotate {
    0%   { transform: rotateX(0) rotateY(0); }
    25%  { transform: rotateX(90deg) rotateY(90deg); }
    50%  { transform: rotateX(180deg) rotateY(180deg); }
    75%  { transform: rotateX(270deg) rotateY(270deg); }
    100% { transform: rotateX(360deg) rotateY(360deg); }
}

/* عنوان درخشان */
.title-glow {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary), var(--primary-light));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shine-text 3s linear infinite;
    text-shadow: none;
}

@keyframes shine-text {
    to { background-position: 200% center; }
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

/* فرم */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* گروه ورودی */
.form-group {
    animation: slideUp 0.5s ease-out;
    animation-fill-mode: both;
}

.form-group:nth-child(2) { animation-delay: 0.1s; }
.form-group:nth-child(3) { animation-delay: 0.2s; }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Wrapper ورودی */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-wrapper:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
    background: rgba(99, 102, 241, 0.05);
}

.input-icon {
    padding: 0 15px;
    color: var(--text-muted);
    transition: color 0.3s;
    display: flex;
    align-items: center;
}

.input-wrapper:focus-within .input-icon {
    color: var(--primary-light);
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 16px 10px 16px 0;
    color: var(--text);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 15px;
    direction: ltr;
    text-align: right;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
    font-family: 'Vazirmatn', sans-serif;
}

.input-border {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: all 0.4s ease;
    transform: translateX(-50%);
}

.input-wrapper:focus-within .input-border {
    width: 100%;
}

/* دکمه نمایش رمز */
.toggle-password {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px 15px;
    transition: color 0.3s;
}

.toggle-password:hover {
    color: var(--primary-light);
}

/* چک‌باکس */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.remember-me input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--glass-border);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.remember-me input:checked ~ .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.remember-me input:checked ~ .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
}

/* دکمه ورود */
.btn-login {
    position: relative;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: perspective(500px) translateZ(0);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    animation: slideUp 0.5s ease-out 0.3s both;
}

.btn-login:hover {
    transform: perspective(500px) translateZ(10px) translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.6);
}

.btn-login:active {
    transform: perspective(500px) translateZ(5px) translateY(0);
}

.btn-login .btn-loader {
    justify-content: center;
    align-items: center;
}

/* اسپینر */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* افکت Ripple */
.btn-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.btn-login:active .btn-ripple {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    to {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* پیام خطا */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.alert-error {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fda4af;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* فوتر */
.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.login-footer p {
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== ریسپانسیو ===== */
@media (max-width: 480px) {
    .login-container {
        padding: 15px;
    }
    
    .login-card {
        padding: 30px 25px;
        border-radius: 20px;
    }
    
    .title-glow {
        font-size: 24px;
    }
}