/* ══════════════════════════════════════════
   إعدادات عامة
   ══════════════════════════════════════════ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    color: #fff;
}

/* ══════════════════════════════════════════
   خلفية الفيديو
   ══════════════════════════════════════════ */
.video-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

#bg-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 25, 0.65);
}

/* ══════════════════════════════════════════
   الحاوية الرئيسية (بتكبر بعد الدخول)
   ══════════════════════════════════════════ */
.app-container {
    text-align: center;
    width: 100%;
    max-width: 420px;        /* حجم اللوجين */
    padding: 20px;
    z-index: 1;
    transition: max-width 0.6s ease;
}

.app-container.expanded {
    max-width: 900px;        /* حجم الـ Workspace */
}

/* ══════════════════════════════════════════
   الهيدر واللوجو
   ══════════════════════════════════════════ */
.main-header {
    margin-bottom: 25px;
    text-align: center;
}

.logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-img {
    width: 55px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.4));
    transition: width 0.6s ease;
}

.app-container.expanded .logo-img {
    width: 100px;
}

.main-header h1 {
    font-size: 2.4rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: font-size 0.6s ease;
}

.app-container.expanded .main-header h1 {
    font-size: 3rem;
}

/* العنوان الفرعي (مخفي وقت اللوجين) */
.subtitle {
    font-size: 0.95rem;
    letter-spacing: 4px;
    color: #b0b0d0;
    text-transform: uppercase;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.5s ease 0.3s, max-height 0.5s ease 0.3s;
}

.app-container.expanded .subtitle {
    opacity: 1;
    max-height: 40px;
}

/* ══════════════════════════════════════════
   الكارت الزجاجي (Glassmorphism)
   ══════════════════════════════════════════ */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 45px 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    transition: padding 0.6s ease;
}

.app-container.expanded .glass-card {
    padding: 50px 40px;
}

/* ══════════════════════════════════════════
   Fade Animation للأقسام
   ══════════════════════════════════════════ */
#login-section,
#workspace-section {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#login-section {
    opacity: 1;
    transform: translateY(0);
}

#login-section.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

/* ترتيب الـ workspace: ترحيب فوق / grid في النص / logout تحت */
#workspace-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(10px);
}

#workspace-section.fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* لما يكون مخفي، نرجّعه none عشان ميظهرش */
#workspace-section.hidden {
    display: none;
}

.hidden {
    display: none;
}

/* ══════════════════════════════════════════
   فورم اللوجين
   ══════════════════════════════════════════ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 15px;
    color: #b0b0d0;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.input-group input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: #00d2ff;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.input-group input:focus + .input-icon {
    color: #00d2ff;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #b0b0d0;
}

/* ══════════════════════════════════════════
   Remember me (محسّن)
   ══════════════════════════════════════════ */
.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.remember-me input[type="checkbox"]:hover {
    border-color: #00d2ff;
}

.remember-me input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #00d2ff, #7928ca);
    border-color: transparent;
}

.remember-me input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ══════════════════════════════════════════
   زرار الدخول
   ══════════════════════════════════════════ */
.submit-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #00d2ff, #7928ca);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

/* رسالة الخطأ */
#login-error {
    color: #ff5b7f;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 5px;
}

/* ══════════════════════════════════════════
   رسالة الترحيب (ثابتة فوق)
   ══════════════════════════════════════════ */
.welcome-msg {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 25px;
    color: #fff;
    flex-shrink: 0;
}

.welcome-msg span {
    color: #00d2ff;
    font-weight: 600;
}

/* ══════════════════════════════════════════
   شبكة الـ Workspace (scroll داخلي)
   ══════════════════════════════════════════ */
.grid-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 40px;

    max-height: 45vh;
    overflow-y: auto;
    padding: 10px;
    margin-right: -5px;
    width: 100%;

    /* ثابت دايماً بنفس الاتجاه عشان مكان الأيقونات ميتغيرش لما اللغة تتغيّر */
    direction: rtl;
}

/* تنسيق الـ scrollbar */
.grid-container::-webkit-scrollbar {
    width: 6px;
}

.grid-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.grid-container::-webkit-scrollbar-thumb {
    background: rgba(0, 210, 255, 0.4);
    border-radius: 10px;
}

.grid-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 210, 255, 0.7);
}

.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.icon-box {
    font-size: 2.2rem;
    color: #e0e0ff;
    margin-bottom: 12px;
    transition: color 0.3s ease, transform 0.3s ease;
}

.grid-item span,
.grid-item a {
    text-decoration: none;
    color: #e0e0e0;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.grid-item:hover {
    transform: translateY(-5px);
}

.grid-item:hover .icon-box {
    color: #00d2ff;
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.6));
}

.grid-item:hover span,
.grid-item:hover a {
    color: #fff;
    font-weight: 600;
}

/* ══════════════════════════════════════════
   زرار تسجيل الخروج (ثابت تحت)
   ══════════════════════════════════════════ */
.logout-btn {
    margin-top: 25px;
    padding: 10px 25px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 91, 127, 0.4);
    border-radius: 8px;
    color: #ff8fa3;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: rgba(255, 91, 127, 0.15);
    color: #ff5b7f;
    border-color: #ff5b7f;
    transform: translateY(-2px);
}

/* ══════════════════════════════════════════
   إشعارات (فوق يمين)
   ══════════════════════════════════════════ */
.notif-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    pointer-events: none;
}

.notif {
    min-width: 240px;
    max-width: 360px;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
    background: rgba(18, 20, 34, 0.94);
    border-left: 4px solid transparent;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateX(120%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.notif.show {
    opacity: 1;
    transform: translateX(0);
}

.notif-info {
    border-left-color: #00d2ff;
}

.notif-error {
    border-left-color: #ff5b7f;
}

/* الأيقونات غير الجاهزة */
.grid-item.coming-soon {
    cursor: default;
}

/* ══════════════════════════════════════════
   أنيميشن دخول الأيقونات (stagger)
   ══════════════════════════════════════════ */
@keyframes itemFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#workspace-section.fade-in .grid-item {
    opacity: 0;
    animation: itemFadeIn 0.4s ease forwards;
}

#workspace-section.fade-in .grid-item:nth-child(1) { animation-delay: 0.05s; }
#workspace-section.fade-in .grid-item:nth-child(2) { animation-delay: 0.10s; }
#workspace-section.fade-in .grid-item:nth-child(3) { animation-delay: 0.15s; }
#workspace-section.fade-in .grid-item:nth-child(4) { animation-delay: 0.20s; }
#workspace-section.fade-in .grid-item:nth-child(5) { animation-delay: 0.25s; }
#workspace-section.fade-in .grid-item:nth-child(6) { animation-delay: 0.30s; }
#workspace-section.fade-in .grid-item:nth-child(7) { animation-delay: 0.35s; }
#workspace-section.fade-in .grid-item:nth-child(8) { animation-delay: 0.40s; }
#workspace-section.fade-in .grid-item:nth-child(9) { animation-delay: 0.45s; }

/* ══════════════════════════════════════════
   متجاوب مع الموبايل
   ══════════════════════════════════════════ */
@media (max-width: 600px) {
    .app-container.expanded .logo-img {
        width: 50px;
    }
    .app-container.expanded .main-header h1 {
        font-size: 2.2rem;
    }
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    .app-container.expanded .glass-card {
        padding: 30px 20px;
    }
}