@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;700;800&family=Cairo:wght@600;700;800&display=swap');

:root {
    --primary-gold: #a37d56;
    --secondary-maroon: #5c1617; 
    --dark-bg: #2b0a0a;
    --border-color: #4a1212;
    --text-light: #E0E0E0;
    --gold-gradient: linear-gradient(135deg, #a37d56 0%, #d4af37 50%, #a37d56 100%);
    --success-green: #2ecc71;
    --error-red: #ff4d4d;
    --highlight-gold: rgba(212, 175, 55, 0.35);
    --card-bg: rgba(43, 10, 10, 0.7);
    --glass-border: rgba(163, 125, 86, 0.35);
}

/* الأساسيات ومنع اهتزاز الشاشة على الأجهزة المحمولة */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin: 0; 
    padding: 0 !important; 
    overflow: hidden !important;
    overscroll-behavior: none !important; 
}

body {
    font-family: 'Noto Sans Arabic', sans-serif;
    color: var(--text-light);
    display: flex; 
    flex-direction: column;
    overflow-x: hidden !important;
}

/* شاشة التحميل (Splash Screen) */
#preloader {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100dvh;
    background: radial-gradient(circle at center, #5c1617 0%, #1a0606 100%);
    display: flex; 
    justify-content: center; 
    align-items: center;
    z-index: 9999999;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s ease-in-out;
    overflow: hidden;
}

/* طبقة التكستشر المحبب (Grain/Noise) */
#preloader::before {
    content: "";
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.15;
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 1;
    animation: grainAnimation 1s steps(10) infinite;
}

@keyframes grainAnimation {
    0%, 100% { background-position: 0 0; }
    10% { background-position: -5% -10%; }
    20% { background-position: -15% 5%; }
    30% { background-position: 7% -25%; }
    40% { background-position: 20% 25%; }
    50% { background-position: -25% 10%; }
    60% { background-position: 15% 5%; }
    70% { background-position: 0% 15%; }
    80% { background-position: 25% 35%; }
    90% { background-position: -10% 10%; }
}

#preloader.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.ship-wheel-logo {
    width: 270px;
    max-width: 60vw;
    height: auto;
    z-index: 2;
    filter: drop-shadow(0 0 20px rgba(0,0,0,0.5));
    animation: helmSteer 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes helmSteer {
    0% { transform: rotate(0deg); }
    15% { transform: rotate(70deg); }
    20% { transform: rotate(50deg); } 
    25% { transform: rotate(55deg); } 
    30% { transform: rotate(55deg); } 
    45% { transform: rotate(-80deg); }
    50% { transform: rotate(-60deg); } 
    55% { transform: rotate(-65deg); } 
    60% { transform: rotate(-65deg); }
    80% { transform: rotate(15deg); }
    85% { transform: rotate(-10deg); }
    90% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

/* الخلفية الثابتة الفاخرة */
.bg-fixed {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background-color: var(--dark-bg);
    background-image: linear-gradient(rgba(43, 10, 10, 0.94), rgba(43, 10, 10, 0.94)), 
                      url('https://i.postimg.cc/Dw127HGG/Gemini-Generated-Image-2h56w02h56w02h56.png');
    background-size: cover; 
    background-position: center;
}

#main-container-wrapper { 
    padding: 15px 10px; 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; 
    width: 100% !important; 
    height: 100dvh !important; 
    max-width: 1600px !important;
    margin: 0 auto;
    box-sizing: border-box; 
    overflow: hidden !important;
    opacity: 1; 
    visibility: visible; 
    transition: opacity 0.3s ease-in-out; 
}

/* الهيدر الأنيق */
.main-header { 
    text-align: center; 
    margin-bottom: 15px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.35s ease, padding 0.35s ease;
    max-height: 300px;
    opacity: 1;
    overflow: visible;
    flex-shrink: 0; 
}

.main-header.scrolled-down {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    pointer-events: none;
    overflow: hidden !important;
}

.logo-container { 
    position: relative; 
    height: 130px; 
    cursor: pointer; 
    width: 100%; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

.logo-container img { 
    max-width: 240px; 
    max-height: 100%; 
    width: auto; 
    height: auto; 
    object-fit: contain; 
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
    transition: transform 0.3s ease;
}

.logo-container:hover img {
    transform: scale(1.03);
}

.app-title {
    color: var(--primary-gold);
    font-family: 'Cairo', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    margin: 5px 0 0 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    letter-spacing: 0.5px;
}

.app-subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
    margin: 3px 0 10px 0;
}

.update-badge {
    margin-top: 5px; 
    background: rgba(0, 0, 0, 0.55); 
    border: 1px solid rgba(163, 125, 86, 0.4);
    border-radius: 50px; 
    padding: 5px 16px; 
    display: inline-flex; 
    align-items: center; 
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.update-badge i { 
    color: var(--primary-gold); 
    animation: pulseIcon 2s infinite alternate; 
}

@keyframes pulseIcon {
    0% { transform: scale(1); filter: brightness(1); }
    100% { transform: scale(1.25); filter: brightness(1.4); }
}

@keyframes spinLogo { 
    100% { transform: rotate(360deg); } 
}

.update-text { 
    font-size: 0.82rem; 
    color: rgba(255, 255, 255, 0.9); 
    font-weight: 500;
}

/* شريط الأدوات (Toolbar) الزجاجي */
.toolbar {
    display: flex; 
    flex-direction: column;
    gap: 12px; 
    background: rgba(26, 5, 5, 0.65) !important; 
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 14px; 
    border-radius: 14px; 
    border: 1px solid var(--glass-border) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
    margin-bottom: 12px; 
    align-items: stretch;
    position: relative; 
    z-index: 100;
    flex-shrink: 0;
    width: 100%;
}

.search-row { 
    display: flex; 
    width: 100%; 
    gap: 10px; 
    align-items: center; 
}

.sticky-logo { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer; 
    max-width: 0; 
    opacity: 0; 
    overflow: hidden; 
    flex-shrink: 0;
    transition: max-width 0.35s ease, opacity 0.35s ease, margin 0.35s ease;
}

.sticky-logo.active {
    max-width: 60px; 
    opacity: 1; 
    margin-left: 5px;
}

.sticky-logo img { 
    height: 40px; 
    object-fit: contain; 
    animation: spinLogo 5s linear infinite; 
}

.sticky-logo img:hover { 
    filter: brightness(1.3); 
}

.search-box { 
    position: relative; 
    flex-grow: 1; 
}

.search-box input {
    width: 100%; 
    background: rgba(18, 4, 4, 0.75) !important; 
    border: 1px solid rgba(163, 125, 86, 0.5) !important;
    padding: 0 45px 0 45px; 
    height: 46px; 
    border-radius: 10px; 
    color: #fff;
    font-family: 'Noto Sans Arabic', sans-serif; 
    outline: none; 
    font-size: 0.95rem; 
    box-sizing: border-box;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
}

.search-box input:focus {
    background: rgba(18, 4, 4, 0.95) !important;
    border-color: #d4af37 !important;
    box-shadow: 0 0 14px rgba(212, 175, 55, 0.4), inset 0 2px 6px rgba(0,0,0,0.4);
}

.search-box i.fa-search { 
    position: absolute; 
    right: 15px; 
    top: 15px; 
    color: var(--primary-gold); 
    font-size: 1rem;
}

.search-box i.clear-search { 
    position: absolute; 
    left: 15px; 
    top: 15px; 
    color: var(--error-red); 
    cursor: pointer; 
    display: none; 
    padding: 2px;
    transition: transform 0.2s;
}

.search-box i.clear-search:hover {
    transform: scale(1.2);
}

/* شريط خيارات الفرز والترتيب (Sort Bar) */
.sort-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    overflow-x: auto;
    padding: 2px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sort-bar::-webkit-scrollbar { display: none; }

.sort-label {
    color: var(--primary-gold);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sort-options {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.sort-chip {
    background: rgba(18, 4, 4, 0.85);
    border: 1px solid rgba(163, 125, 86, 0.4);
    color: var(--text-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-family: 'Noto Sans Arabic', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    outline: none;
}

.sort-chip:hover {
    border-color: var(--primary-gold);
    background: rgba(163, 125, 86, 0.2);
    color: #fff;
}

.sort-chip.active {
    background: var(--gold-gradient);
    color: #1a0505;
    border-color: #d4af37;
    font-weight: 800;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.4);
}

/* مجموعة أزرار الإجراءات */
.btn-group { 
    display: flex; 
    gap: 8px; 
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-top: 1px solid rgba(163, 125, 86, 0.2);
    padding-top: 10px;
}

.btn-sub-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    padding: 0 16px; 
    height: 40px; 
    border-radius: 8px; 
    border: none;
    cursor: pointer; 
    font-weight: 700; 
    font-family: 'Noto Sans Arabic', sans-serif; 
    gap: 7px;
    white-space: nowrap; 
    font-size: 0.85rem;
    transition: all 0.25s ease;
}

.btn:active {
    transform: scale(0.96);
}

.btn-add { 
    background: var(--gold-gradient); 
    color: #1a0505; 
    box-shadow: 0 3px 10px rgba(163, 125, 86, 0.3);
}
.btn-add:hover {
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.5);
    filter: brightness(1.1);
}

.btn-bulk { 
    background: #3d0d0d; 
    border: 1px solid var(--primary-gold); 
    color: var(--primary-gold); 
}
.btn-bulk:hover {
    background: rgba(163, 125, 86, 0.2);
}

.btn-excel { 
    background: #0f3d1e; 
    border: 1px solid var(--success-green); 
    color: #2ecc71; 
}
.btn-excel:hover {
    background: #145228;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.4);
}

.btn-view-toggle {
    background: #1a0505; 
    border: 1px solid rgba(163, 125, 86, 0.5); 
    color: var(--primary-gold); 
}
.btn-view-toggle:hover {
    background: rgba(163, 125, 86, 0.15);
}

.btn-reset {
    background: transparent;
    color: #e74c3c;
    border: 1px dashed rgba(231, 76, 60, 0.5);
    padding: 0 12px;
    height: 38px;
    font-size: 0.8rem;
}
.btn-reset:hover {
    background: rgba(231, 76, 60, 0.1);
}

/* حاوية الجدول والكروت */
.content-container {
    flex-grow: 1; 
    overflow-x: auto !important; 
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    touch-action: pan-x pan-y;
    width: 100%; 
    max-width: 100%; 
    display: block; 
    position: relative;
    border-radius: 12px;
    box-shadow: 0 6px 25px rgba(0,0,0,0.5);
    border: 1px solid rgba(163, 125, 86, 0.25);
    background: rgba(20, 4, 4, 0.45);
}

/* أسلوب عرض الجدول (Table View) */
table { 
    width: 100%; 
    border-collapse: collapse; 
    min-width: 550px; 
}

th { 
    background: var(--secondary-maroon); 
    color: var(--primary-gold); 
    padding: 14px 12px; 
    font-size: 0.9rem; 
    font-weight: 800;
    border-bottom: 2px solid var(--primary-gold); 
    text-align: center;
    position: sticky; 
    top: 0; 
    z-index: 50; 
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

td { 
    padding: 12px 8px; 
    border-bottom: 1px solid rgba(74, 18, 18, 0.6); 
    text-align: center; 
    vertical-align: middle;
    transition: background-color 0.2s ease;
}

tr:nth-child(even) td {
    background-color: rgba(43, 10, 10, 0.35);
}

tr:hover td {
    background-color: rgba(163, 125, 86, 0.12);
}

/* تمييز السطر النشط المختار */
@keyframes highlightPulse {
    0% { background-color: rgba(163, 125, 86, 0.1); }
    50% { background-color: rgba(163, 125, 86, 0.35); }
    100% { background-color: rgba(163, 125, 86, 0.1); }
}

tr.active-row td {
    animation: highlightPulse 2.5s infinite !important;
    border-top: 1px solid var(--primary-gold) !important;
    border-bottom: 1px solid var(--primary-gold) !important;
}

/* تنسيق خلايا الجدول */
.cell-original {
    font-size: 0.98rem;
    font-weight: 700;
    color: #fff;
    text-align: right;
    padding-right: 15px !important;
}

.cell-inspired {
    font-family: 'Cairo', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffd875;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    text-align: right;
    padding-right: 15px !important;
}

.cell-color {
    text-align: center;
    padding: 8px 10px !important;
}

.color-badge-container {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(22, 5, 5, 0.85);
    border: 1px solid rgba(163, 125, 86, 0.4);
    padding: 6px 14px 6px 8px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    transition: all 0.25s ease;
}

.color-badge-container:hover {
    border-color: #d4af37;
    box-shadow: 0 6px 20px rgba(163, 125, 86, 0.3);
    transform: translateY(-2px);
}

/* درجة اللون الكبيرة البارزة */
.color-preview {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: transform 0.25s ease;
    cursor: pointer;
}

.color-preview:hover {
    transform: scale(1.1);
}

.color-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    text-align: left;
}

.color-name {
    font-size: 0.92rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

/* زر وبادج نسخ كود اللون */
.color-hex-btn {
    background: rgba(43, 10, 10, 0.9);
    border: 1px solid rgba(212, 175, 55, 0.5);
    color: #ffd875;
    padding: 2px 8px;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    outline: none;
}

.color-hex-btn:hover {
    background: var(--gold-gradient);
    color: #1a0505;
    border-color: #ffd875;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
    transform: scale(1.05);
}

.color-hex-btn:active {
    transform: scale(0.95);
}

.color-hex-btn i {
    font-size: 0.72rem;
}

.idx-cell {
    color: var(--primary-gold);
    font-weight: bold;
    font-size: 0.85rem;
    width: 45px;
}

/* شارات الجنس والفئات */
.gender-badge {
    padding: 5px 12px; 
    border-radius: 20px; 
    font-family: 'Noto Sans Arabic'; 
    font-size: 0.8rem; 
    font-weight: bold; 
    user-select: none;
    border: 1px solid transparent; 
    min-width: 85px; 
    text-align: center;
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    gap: 6px;
    margin: 0 auto; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.gender-badge.homme { background: #0b2b42; color: #4dc0ff; border-color: #3498db; }
.gender-badge.femme { background: #4a1114; color: #ff6b6b; border-color: #e74c3c; }
.gender-badge.unisex { background: #3d2f14; color: #ffdc73; border-color: #d4af37; }

.gender-badge.homme::before { content: "\f222"; font-family: "Font Awesome 6 Free"; font-weight: 900; }
.gender-badge.femme::before { content: "\f221"; font-family: "Font Awesome 6 Free"; font-weight: 900; }
.gender-badge.unisex::before { content: "\f228"; font-family: "Font Awesome 6 Free"; font-weight: 900; }

.category-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-block;
    background: rgba(26, 5, 5, 0.7);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* تظليل البحث (Highlighting) */
.search-highlight {
    background-color: var(--highlight-gold);
    color: #ffffff;
    font-weight: 800;
    padding: 0 3px;
    border-radius: 3px;
    box-shadow: 0 0 6px rgba(212, 175, 55, 0.6);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* أزرار الإجراءات في الخلايا */
.action-btns { 
    display: flex; 
    gap: 6px; 
    justify-content: center; 
    align-items: center;
}

.action-btn { 
    width: 36px; 
    height: 36px; 
    border-radius: 8px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border: none; 
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-btn:hover {
    transform: scale(1.12);
}

.copy-btn { 
    color: #1a0505; 
    background: var(--gold-gradient); 
    box-shadow: 0 2px 8px rgba(163, 125, 86, 0.4);
    font-weight: bold;
}
.copy-btn:hover {
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.8);
}

.edit-btn { 
    color: #4dc0ff; 
    background: #0b2b42; 
    border: 1px solid rgba(52, 152, 219, 0.4); 
}

.delete-btn { 
    color: #ff4d4d; 
    background: #3d1411; 
    border: 1px solid rgba(255, 77, 77, 0.4); 
}

/* أسلوب عرض الكروت (Cards Grid View) - مثالي للجوال */
.cards-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 16px;
}

.content-container.view-cards table {
    display: none !important;
}

.content-container.view-cards .cards-grid {
    display: grid !important;
}

.inspiration-card {
    background: linear-gradient(145deg, rgba(43, 10, 10, 0.8), rgba(26, 5, 5, 0.9));
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.inspiration-card::top-right {
    content: '';
    position: absolute;
    top: 0; right: 0; width: 60px; height: 60px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, transparent 70%);
}

.inspiration-card:hover {
    transform: translateY(-4px);
    border-color: #d4af37;
    box-shadow: 0 12px 30px rgba(163, 125, 86, 0.25);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(163, 125, 86, 0.2);
    padding-bottom: 10px;
}

.card-num {
    background: rgba(163, 125, 86, 0.2);
    color: var(--primary-gold);
    font-size: 0.8rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 6px;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 2px;
}

.card-original-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

.card-inspired-title {
    font-family: 'Cairo', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffd875;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    margin: 4px 0;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(163, 125, 86, 0.2);
    padding-top: 12px;
    margin-top: 4px;
}

/* أنيميشن دخول الأصناف */
@keyframes fadeInRow {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    opacity: 0;
    animation: fadeInRow 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* إشعارات الـ Toast السريعة والمبهرة */
#toast {
    position: fixed; 
    bottom: 40px; 
    left: 50%; 
    transform: translateX(-50%) translateY(50px);
    background: var(--gold-gradient); 
    color: #1a0505; 
    padding: 12px 24px; 
    font-size: 0.95rem;
    border-radius: 30px; 
    display: flex; 
    align-items: center;
    gap: 10px;
    z-index: 30000; 
    font-weight: 800; 
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* النوافذ المنبثقة (Modals) */
.modal-overlay {
    display: none; 
    position: fixed; 
    z-index: 20000; 
    left: 0; top: 0; 
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85); 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    justify-content: center; 
    align-items: center;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

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

.modal-content {
    background: #1e0606; 
    border: 1px solid var(--primary-gold); 
    border-radius: 16px; 
    padding: 25px;
    width: 100%; 
    max-width: 520px; 
    position: relative; 
    max-height: 90dvh; 
    overflow-y: auto;
    box-shadow: 0 15px 40px rgba(0,0,0,0.8);
    transform: scale(0.9);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-modal { 
    position: absolute; 
    top: 15px; left: 15px; 
    color: var(--primary-gold); 
    font-size: 24px; 
    cursor: pointer; 
    width: 35px; height: 35px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    transition: 0.2s;
}

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

.form-group {
    margin-bottom: 16px;
    text-align: right;
}

.form-group label {
    display: block;
    font-size: 0.88rem;
    color: var(--primary-gold);
    font-weight: bold;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: rgba(30, 8, 8, 0.8);
    border: 1px solid rgba(163, 125, 86, 0.5);
    padding: 10px 14px;
    border-radius: 8px;
    color: #fff;
    font-family: 'Noto Sans Arabic', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

textarea.form-control {
    min-height: 140px;
    resize: vertical;
}

/* زر التمرير لأعلى */
.top-float { 
    position: fixed; 
    left: 20px; bottom: 20px; 
    width: 44px; height: 44px; 
    background: var(--gold-gradient); 
    color: #1a0505; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 18px; 
    z-index: 9999; 
    opacity: 0; 
    visibility: hidden; 
    cursor: pointer; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    transition: all 0.3s ease;
}

.top-float.show { 
    opacity: 1; 
    visibility: visible; 
}

.top-float:hover {
    transform: translateY(-3px) scale(1.05);
}

/* تخصيص شريط التمرير */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--dark-bg);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: rgba(163, 125, 86, 0.5);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-gold);
}

/* التجاوب مع الجوال والشاشات الصغيرة */
@media (max-width: 768px) {
    #main-container-wrapper { 
        padding: 8px 4px !important; 
    }
    
    .main-header {
        margin-bottom: 8px;
    }
    
    .logo-container { 
        height: 130px !important; 
    }
    
    .logo-container img {
        max-width: 85%;
    }
    
    .app-title {
        font-size: 1.15rem;
    }
    
    .toolbar { 
        padding: 10px; 
        gap: 10px; 
    }
    
    .btn-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .btn-sub-group {
        justify-content: center;
        width: 100%;
    }
    
    .btn { 
        height: 36px; 
        padding: 0 12px; 
        font-size: 0.8rem; 
        flex: 1;
    }
    
    td { 
        padding: 8px 6px !important; 
        font-size: 0.85rem !important; 
    }
    
    th { 
        padding: 10px 6px !important; 
        font-size: 0.85rem !important; 
    }
    
    .cell-original, .cell-inspired {
        padding-right: 8px !important;
        font-size: 0.92rem;
    }

    .color-badge-container {
        padding: 4px 8px 4px 6px;
        gap: 8px;
    }

    .color-preview {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .color-name {
        font-size: 0.84rem;
    }

    .color-hex-btn {
        font-size: 0.72rem;
        padding: 1px 6px;
    }
    
    .gender-badge {
        min-width: 70px;
        font-size: 0.75rem;
        padding: 3px 8px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 12px;
    }
}

/* أوامر الطباعة */
@media print {
    body { background: #fff !important; color: #000 !important; padding: 0 !important; height: auto !important; overflow: visible !important; position: static !important; }
    #main-container-wrapper { height: auto !important; overflow: visible !important; width: 100% !important; max-width: 100% !important; padding: 0 !important; }
    .main-header, .toolbar, .top-float, #toast, .modal-overlay, .bg-fixed, .action-btns { display: none !important; }
    .content-container { background: transparent !important; border: none !important; box-shadow: none !important; overflow: visible !important; margin: 0 !important; display: table !important; }
    table { min-width: 100% !important; border-collapse: collapse !important; }
    th { background: #f2f2f2 !important; color: #000 !important; border: 1px solid #000 !important; position: static !important; font-size: 12px !important; padding: 6px !important; box-shadow: none !important; }
    td { border: 1px solid #000 !important; color: #000 !important; position: static !important; font-size: 12px !important; padding: 5px !important; background: transparent !important; }
    th:last-child, td:last-child { display: none !important; }
    .search-highlight { background: transparent !important; color: #000 !important; text-decoration: underline !important; }
    .gender-badge { background: transparent !important; color: #000 !important; border: 1px solid #000 !important; box-shadow: none !important; }
    .gender-badge::before { display: none !important; }
}
