@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    --bg-dark: #090a0a;
    --bg-panel: rgba(15, 15, 15, 0.7);
    --accent: #4ea7fc;
    /* اللون الأزرق المستخدم في الموقع الصيني */
    --border: rgba(255, 255, 255, 0.08);
    --text-main: rgba(255, 255, 255, 0.85);
    --text-dim: rgba(255, 255, 255, 0.5);
    --header-height: 64px;
}

body,
input,
button,
select,
textarea {
    font-family: 'Tajawal', sans-serif !important;
}

body {
    background-color: var(--bg-dark) !important;
    color: var(--text-main);
    margin: 0;
    overflow: hidden;
    height: 100vh;
}

/* التقسيم الثلاثي الاحترافي */
.app-layout {
    display: grid;
    grid-template-columns: 320px 1fr 300px;
    height: 100vh;
    padding-top: var(--header-height);
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(9, 10, 10, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
}

.logo {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    color: white;
}

/* Sidebars */
.sidebar {
    width: 280px;
    background-color: var(--bg-panel);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* تمكين التمرير */
    height: calc(100vh - var(--header-height));
}

.panel-title {
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Assets Grid */
.assets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px;
    overflow-y: auto;
}

.asset-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

.asset-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.asset-card img {
    width: 100%;
    height: 90px;
    object-fit: contain;
    border-radius: 6px;
    background: #050505;
    background-image: linear-gradient(45deg, #111 25%, transparent 25%), linear-gradient(-45deg, #111 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #111 75%), linear-gradient(-45deg, transparent 75%, #111 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
}

.asset-card .name {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 8px;
    text-align: center;
}

/* Center Area Refinement */
.work-area {
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0);
    background-size: 32px 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

#svga-canvas {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    background: #000;
    max-width: 95%;
    max-height: 85%;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 60px;
    /* ترك مسافة لـ player-bar */
}

#svga-canvas div {
    /* التأكد من أن المشغل الداخلي يتوسط الحاوية */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Player Controls */
.player-bar {
    position: absolute;
    bottom: 32px;
    width: 400px;
    background: rgba(25, 25, 25, 0.9);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    border-radius: 100px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.input-ctrl {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 8px;
    color: white !important;
    /* التأكد من أن النص أبيض */
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.progress-track {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    position: relative;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--accent);
    border-radius: 2px;
}

/* Utility */
.btn-main {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

.info-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 12px;
    margin: 12px;
    border: 1px solid var(--border);
}

.info-label {
    font-size: 12px;
    color: var(--text-dim);
}

.info-val {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-top: 4px;
}

/* Premium Loading Screen */
#loading-screen {
    position: fixed;
    inset: 0;
    background: #0f0f0f;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.5s ease-out;
}

.loading-logo {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
    animation: fadeInDown 0.8s ease-out;
}

/* Format Badges */
.format-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 2rem;
    animation: fadeIn 1s ease-in 0.2s both;
}

.badge-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

/* The Animated Loader from the site */
.loader-container {
    margin: 2rem 0;
}

.loader-bars {
    width: 40px;
    height: 26px;
    --c: no-repeat linear-gradient(#667eea 0 0);
    background: var(--c) 0 100%, var(--c) 50% 100%, var(--c) 100% 100%;
    background-size: 8px calc(100% - 4px);
    position: relative;
}

.loader-bars:before {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #764ba2;
    left: 0;
    top: 0;
    animation: l3-1 1.5s linear infinite alternate, l3-2 0.75s cubic-bezier(0, 200, 0.8, 200) infinite;
}

@keyframes l3-1 {
    100% {
        left: calc(100% - 8px);
    }
}

@keyframes l3-2 {
    100% {
        top: -0.1px;
    }
}

/* Upload Zone Shell */
.upload-zone-shell {
    width: 500px;
    height: 240px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.02);
}

.upload-zone-shell:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: scale(1.02);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: #667eea;
    margin-bottom: 20px;
    opacity: 0.8;
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    margin-top: 10px;
    transition: all 0.2s;
    font-family: 'Tajawal', sans-serif;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-dim);
}

.btn-main {
    font-family: 'Tajawal', sans-serif !important;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 20000;
    pointer-events: none;
}

.toast {
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: translateX(120%);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    font-family: 'Tajawal', sans-serif;
    pointer-events: auto;
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon svg {
    width: 12px;
    height: 12px;
    color: white;
}

.toast-msg {
    font-size: 14px;
    font-weight: 500;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}