/* ======================== المتغيرات العامة ======================== */
:root {
    --bg-primary: rgba(0, 0, 0, 0.3);
    --bg-secondary: rgba(255, 255, 255, 0.05);
    --text-primary: white;
    --text-secondary: #b5bac1;
    --accent-color: #5865F2;
    --accent-hover: #4752C4;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-bg: #111214;
    --shadow-color: rgba(0, 0, 0, 0.4);
}

.light-mode {
    --bg-primary: rgba(255, 255, 255, 0.7);
    --bg-secondary: rgba(0, 0, 0, 0.05);
    --text-primary: #1e1f22;
    --text-secondary: #4e5058;
    --accent-color: #5865F2;
    --accent-hover: #4752C4;
    --border-color: rgba(0, 0, 0, 0.1);
    --card-bg: #f2f3f5;
    --shadow-color: rgba(0, 0, 0, 0.2);
}

/* ======================== الأنماط العامة ======================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Whitney', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    transition: background 0.5s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow-x: hidden;
    color: var(--text-primary);
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* ======================== شاشة الافتتاحية ======================== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    color: white;
}

.splash-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #5865F2;
    border-radius: 50%;
    animation: spin 1s ease infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ======================== الحاوية الرئيسية ======================== */
.container {
    max-width: 400px;
    width: 100%;
    background: var(--bg-primary);
    backdrop-filter: blur(12px);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 15px 35px var(--shadow-color);
    border: 1px solid var(--border-color);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.header-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

h1 {
    color: var(--text-primary);
    text-align: center;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    margin: 0;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: var(--accent-color);
    color: white;
}

.input-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

.input-section h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 16px;
}

/* ======================== حقول الإدخال ======================== */
.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 14px;
    border: 1px solid var(--border-color);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

button {
    padding: 12px 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s, box-shadow 0.1s, background 0.3s;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}

button:hover {
    background: var(--accent-hover);
}

button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}

#fetchBtn {
    background: var(--accent-color);
    white-space: nowrap;
}

/* ======================== أزرار التحميل المنفصلة ======================== */
.download-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#downloadAvatarBtn, #downloadBannerBtn {
    flex: 1;
    padding: 10px;
    background: #2b2d31;
    color: white;
    border: 1px solid #3c3f45;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

#downloadAvatarBtn:hover, #downloadBannerBtn:hover {
    background: #404249;
}

#downloadAvatarBtn:disabled, #downloadBannerBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ======================== الحالة ======================== */
.status-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.status-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.status-option input {
    display: none;
}

.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.status-option input:checked + .status-badge {
    border-color: var(--text-primary);
    transform: scale(1.05);
    box-shadow: 0 0 10px currentColor;
}

.status-online { background: #23a55a; color: white; }
.status-idle { background: #f0b232; color: white; }
.status-dnd { background: #f23f42; color: white; }
.status-offline { background: #80848e; color: white; }

/* ======================== البحث والتصفية ======================== */
.badges-controls {
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.filter-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.filter-btn {
    flex: 1;
    padding: 6px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    box-shadow: none;
}

.filter-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.filter-btn:hover {
    background: rgba(88, 101, 242, 0.5);
}

/* ======================== شريط التمرير المخصص ======================== */
.badges-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    border-top: 1px solid var(--border-color);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) rgba(0,0,0,0.2);
}

.badges-selector::-webkit-scrollbar {
    width: 6px;
}

.badges-selector::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

.badges-selector::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10px;
}

.badges-selector::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

/* ======================== خيارات البيدجات ======================== */
.badge-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    min-width: 120px;
}

.badge-option:hover {
    background: rgba(88, 101, 242, 0.3);
}

.badge-option input {
    display: none;
}

.badge-option .badge-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: contain;
    background-color: #2b2d31;
}

.badge-option .badge-name {
    color: var(--text-primary);
    font-size: 12px;
    flex: 1;
}

.badge-option .badge-check {
    color: var(--accent-color);
    display: none;
}

.badge-option input:checked ~ .badge-check {
    display: inline;
}

/* ======================== منتقي الألوان ======================== */
.color-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 8px 12px;
    border-radius: 8px;
}

.color-input-group label {
    color: var(--text-secondary);
    font-size: 13px;
    min-width: 50px;
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 50px;
    border: 3px solid var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-input-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.color-input-group input[type="text"] {
    flex: 1;
    padding: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: monospace;
}

/* ======================== أزرار الخلفية مع أيقونات ======================== */
.background-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.bg-btn {
    position: relative;
    padding: 8px 12px;
    padding-left: 30px;
    background: rgba(0,0,0,0.3);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    flex: 1 0 auto;
    min-width: 90px;
    overflow: hidden;
    box-shadow: none;
}

.bg-btn::before {
    content: attr(data-icon);
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    filter: drop-shadow(0 0 2px currentColor);
}

.bg-btn:hover {
    background: rgba(88, 101, 242, 0.5);
    border-color: var(--accent-color);
    transform: scale(1.02);
}

/* ======================== الكارد ======================== */
.card-container {
    position: relative;
    margin-bottom: 30px;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--shadow-color);
    margin-bottom: 0px;
    color: white;
    border: 1px solid #2b2d31;
    width: 100%;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    position: relative;
    z-index: 2;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px var(--shadow-color);
}

/* الصورة الرمزية - بدون أي توهج */
.avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 5px solid var(--card-bg);
    margin-top: -50px;
    margin-left: 20px;
    object-fit: cover;
    background: #2b2d31;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* تأثير المرآة */
.card-reflection {
    width: 90%;
    height: 30px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    border-radius: 50%;
    margin: -20px auto 0;
    filter: blur(10px);
    opacity: 0.5;
    transform: scale(0.9);
}

/* باقي أجزاء الكارد */
.banner {
    height: 120px;
    background-size: cover;
    background-position: center;
    background-color: #1e1f22;
    position: relative;
}

.banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, var(--card-bg), transparent);
}

.info {
    padding: 12px 20px 24px;
}

.name-container {
    margin-bottom: 12px;
}

.info h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* دائرة لون البروفايل */
.profile-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--text-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: inline-block;
}

/* البيدجات داخل الكارد */
.badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 16px 0;
    min-height: 28px;
}

.badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #2b2d31;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    position: relative;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.badge img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: contain;
}

/* Tooltip مخصص */
.badge::after {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 10;
}

.badge:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

/* ألوان البروفايل داخل الكارد */
.profile-colors {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 0;
    margin-right: auto;
}

.color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--text-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.color-hex {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

/* حاوية الحالة */
.status-container {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2b2d31;
    padding: 8px 16px;
    border-radius: 24px;
    border: 1px solid #3c3f45;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: relative;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(35, 165, 90, 0); }
    100% { box-shadow: 0 0 0 0 rgba(35, 165, 90, 0); }
}

.status-indicator::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    background: inherit;
    opacity: 0.3;
    z-index: -1;
}

.status-online { background-color: #23a55a; }
.status-idle { background-color: #f0b232; }
.status-dnd { background-color: #f23f42; }
.status-offline { background-color: #80848e; }

.status-text {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

/* ======================== إحصائيات الحساب ======================== */
.stats-section {
    display: block;
}

.stats-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stats-content p {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 13px;
}

.stats-content span:last-child {
    color: var(--text-primary);
    font-weight: 600;
}

/* ======================== زر التحميل الرئيسي ======================== */
#downloadBtn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: #23a559;
    color: white;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

#downloadBtn:hover {
    background: #1a8c48;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(35, 165, 89, 0.4);
}

/* ======================== توقيع (credit) ======================== */
.credit {
    text-align: right;
    margin-top: 15px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.credit span {
    display: block;
}

/* ======================== خلفيات متحركة (10 تأثيرات) ======================== */
/* 1. Static */
.bg-static {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* 2. Night Sky */
.bg-nightSky {
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
}
.bg-nightSky::after {
    background: transparent url('https://i.imgur.com/YKZQ9gM.png') repeat;
    animation: starMove 30s linear infinite;
}
@keyframes starMove {
    from { transform: translateY(0); }
    to { transform: translateY(-200px); }
}

/* 3. Ocean Waves */
.bg-oceanWaves {
    background: linear-gradient(180deg, #020111, #3b6d8c);
}
.bg-oceanWaves::after {
    background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/85486/wave.svg') repeat-x bottom;
    animation: wave 8s linear infinite;
}
@keyframes wave {
    0% { background-position: 0 bottom; }
    100% { background-position: 100px bottom; }
}

/* 4. Rotating Gradient */
.bg-rotatingGradient {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #f9ca24);
    background-size: 400% 400%;
    animation: gradient 10s ease infinite;
}
@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 5. Stars GIF */
.bg-starsGif {
    background: url('https://i.gifer.com/7Z7M.gif') center/cover fixed;
}

/* 6. Floating Particles */
.bg-floatingParticles {
    background: #0a0f1e;
}
.bg-floatingParticles::after {
    background: transparent;
    background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.8) 1px, transparent 1px),
                      radial-gradient(circle at 80% 70%, rgba(200,220,255,0.6) 2px, transparent 2px),
                      radial-gradient(circle at 40% 80%, rgba(255,255,180,0.5) 1px, transparent 1px),
                      radial-gradient(circle at 90% 20%, rgba(170,200,255,0.7) 2px, transparent 2px);
    background-size: 200px 200px;
    animation: floatParticles 15s linear infinite;
}
@keyframes floatParticles {
    0% { background-position: 0 0, 0 0, 0 0, 0 0; }
    100% { background-position: 200px 200px, -200px 100px, 100px -150px, -100px 250px; }
}

/* 7. Pulse */
.bg-pulse {
    background: #1e2a3a;
    animation: pulseBg 4s ease infinite;
}
@keyframes pulseBg {
    0% { background-color: #1e2a3a; }
    50% { background-color: #2c3e50; }
    100% { background-color: #1e2a3a; }
}

/* 8. Rain */
.bg-rain {
    background: #1b2635;
}
.bg-rain::after {
    background: transparent;
    background-image: linear-gradient(to bottom, rgba(174, 194, 224, 0.3) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: rain 0.3s linear infinite;
}
@keyframes rain {
    from { background-position: 0 0; }
    to { background-position: 0 30px; }
}

/* 9. Snow */
.bg-snow {
    background: #1f2a3f;
}
.bg-snow::after {
    background: transparent;
    background-image: radial-gradient(circle at 10% 20%, white 2px, transparent 2px),
                      radial-gradient(circle at 30% 40%, white 3px, transparent 3px),
                      radial-gradient(circle at 70% 60%, white 2px, transparent 2px),
                      radial-gradient(circle at 90% 80%, white 3px, transparent 3px);
    background-size: 150px 150px;
    animation: snow 8s linear infinite;
}
@keyframes snow {
    0% { background-position: 0 0, 0 0, 0 0, 0 0; }
    100% { background-position: 100px 600px, 200px 500px, -100px 700px, -200px 800px; }
}

/* 10. Aurora */
.bg-aurora {
    background: linear-gradient(180deg, #0b1a2e 0%, #1a3b4f 50%, #0f2c3b 100%);
    animation: auroraColor 12s ease infinite;
}
@keyframes auroraColor {
    0% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(10deg); }
    100% { filter: hue-rotate(0deg); }
}
.bg-aurora::after {
    background: transparent;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0 50 Q 20 30, 40 50 T 80 50" stroke="rgba(100,255,200,0.2)" fill="none" stroke-width="2"/><path d="M0 60 Q 30 40, 60 70 T 100 60" stroke="rgba(150,100,255,0.2)" fill="none" stroke-width="3"/><path d="M0 70 Q 40 50, 70 80 T 100 70" stroke="rgba(200,150,255,0.15)" fill="none" stroke-width="4"/></svg>');
    background-size: 200% 200%;
    background-repeat: repeat-x;
    animation: auroraMove 20s linear infinite;
    opacity: 0.5;
}
@keyframes auroraMove {
    0% { background-position: 0 0; }
    100% { background-position: 200% 0; }
}

/* ======================== الوضع الفاتح للخلفيات ======================== */
.light-mode .bg-static {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
}
.light-mode .bg-nightSky {
    background: radial-gradient(ellipse at bottom, #a5b4fc, #6366f1);
}
.light-mode .bg-oceanWaves {
    background: linear-gradient(180deg, #bae6fd, #38bdf8);
}
.light-mode .bg-rotatingGradient {
    background: linear-gradient(45deg, #fca5a5, #6ee7b7, #7dd3fc, #fde047);
    background-size: 400% 400%;
}
.light-mode .bg-starsGif {
    filter: invert(1);
}
.light-mode .bg-floatingParticles {
    background: #f0f9ff;
}
.light-mode .bg-pulse {
    background: #dbeafe;
    animation: pulseBgLight 4s ease infinite;
}
@keyframes pulseBgLight {
    0% { background-color: #dbeafe; }
    50% { background-color: #bfdbfe; }
    100% { background-color: #dbeafe; }
}
.light-mode .bg-rain {
    background: #cbd5e1;
}
.light-mode .bg-snow {
    background: #e2e8f0;
}
.light-mode .bg-aurora {
    background: linear-gradient(180deg, #bbf7d0, #a5f3fc, #c7d2fe);
}