/* Vazirmatn loaded non-blocking from HTML head */
:root {
    --primary: #ff7200;
    --primary-dark: #cc5a00;
    --secondary: #7c3aed;
    --bg-dark: #050b14;
    --bg-card: rgba(10, 20, 40, 0.85);
    --bg-glow: rgba(255,114,0,0.08);
    --text-light: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: rgba(255,114,0,0.2);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ======================== PUBLIC PAGE ======================== */
.public-page {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    background: radial-gradient(ellipse at 20% 50%, rgba(255,114,0,0.35) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(255,140,0,0.25) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(200,60,0,0.2) 0%, transparent 50%),
                linear-gradient(180deg, #1a0800 0%, #2d0e00 30%, #1a0800 70%, #0d0400 100%);
}

.laser-grid {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(rgba(255,114,0,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,114,0,0.08) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.laser-line {
    position: fixed;
    width: 2px;
    height: 100vh;
    background: linear-gradient(180deg, transparent 0%, rgba(255,114,0,0.6) 50%, transparent 100%);
    top: 0;
    animation: laserScan 6s ease-in-out infinite;
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}
.laser-line:nth-child(2) { animation-delay: -2s; left: 30%; opacity: 0.3; }
.laser-line:nth-child(3) { animation-delay: -4s; left: 70%; opacity: 0.2; }

@keyframes laserScan {
    0% { left: -5%; }
    100% { left: 105%; }
}

.particles {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}
.particle {
    position: absolute;
    width: 2px; height: 2px;
    border-radius: 50%;
    background: var(--primary);
    animation: float linear infinite;
    opacity: 0;
}
@keyframes float {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { transform: translateY(-10vh) scale(1.5); opacity: 0; }
}

/* Header */
.site-header {
    position: relative;
    z-index: 10;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    background: rgba(5, 11, 20, 0.6);
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon {
    width: 170px; height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
    box-shadow: 0 0 28px rgba(255,114,0,0.5);
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-light);
    line-height: 1.2;
}
.logo-text span { display: block; font-size: 0.75rem; color: var(--primary); font-weight: 400; }

.header-admin-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    transition: all 0.3s;
}
.header-admin-link:hover { color: var(--primary); border-color: var(--primary); }

/* Hero Section */
.hero-section {
    position: relative;
    z-index: 10;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,114,0,0.1);
    border: 1px solid rgba(255,114,0,0.3);
    border-radius: 20px;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    color: var(--primary);
    margin-bottom: 2rem;
    animation: pulse-glow 3s ease-in-out infinite;
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(255,114,0,0.2); }
    50% { box-shadow: 0 0 20px rgba(255,114,0,0.5); }
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary) 50%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    max-width: 500px;
}

/* Search Card */
.search-card {
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    box-shadow: 0 0 40px rgba(255,114,0,0.1), 0 25px 60px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}
.search-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), transparent);
}

.search-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.search-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1.2rem;
    color: #fff;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    direction: ltr;
    text-align: center;
    letter-spacing: 2px;
    transition: all 0.3s;
    outline: none;
}
.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(255,114,0,0.2);
    background: rgba(255,114,0,0.05);
}
.search-input::placeholder { color: #4a5568; letter-spacing: 1px; direction: rtl; text-align: center; }

.search-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 12px;
    padding: 0.85rem 1.8rem;
    color: #fff;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(255,114,0,0.3);
}
.search-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(255,114,0,0.5); }
.search-btn:active { transform: translateY(0); }

.search-hint { font-size: 0.8rem; color: #4a5568; text-align: center; }

/* Result Section */
.result-section { margin-top: 2rem; }

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: 0 0 40px rgba(255,114,0,0.1);
    animation: slideUp 0.4s ease;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-status-bar {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
}
.result-status-bar.success { background: rgba(16,185,129,0.15); border-bottom: 1px solid rgba(16,185,129,0.3); color: #10b981; }
.result-status-bar.warning { background: rgba(245,158,11,0.15); border-bottom: 1px solid rgba(245,158,11,0.3); color: #f59e0b; }
.result-status-bar.danger { background: rgba(239,68,68,0.15); border-bottom: 1px solid rgba(239,68,68,0.3); color: #ef4444; }

.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: blink 1.5s ease-in-out infinite;
}
.success .status-dot { background: #10b981; box-shadow: 0 0 8px #10b981; }
.warning .status-dot { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.danger .status-dot { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.result-body { padding: 1.5rem; }

.device-images-section {
    margin-bottom: 1.5rem;
}
.device-images-grid {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.device-image-thumb {
    width: 100px; height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s;
}
.device-image-thumb:hover { transform: scale(1.05); }

.device-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 500px) { .device-info-grid { grid-template-columns: 1fr; } }

.info-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 0.8rem 1rem;
}
.info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.info-label .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.info-value { font-size: 0.95rem; font-weight: 600; color: var(--text-light); }

.serial-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(255,114,0,0.15), rgba(124,58,237,0.15));
    border: 1px solid rgba(255,114,0,0.3);
    border-radius: 8px;
    padding: 0.3rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    font-family: monospace;
    direction: ltr;
    letter-spacing: 1px;
}

.warranty-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}
.warranty-chip.valid { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.warranty-chip.expired { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }

.created-by-note {
    font-size: 0.8rem;
    color: #4a5568;
    margin-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-search-again {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.7rem 1.5rem;
    color: var(--primary);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    margin-top: 1.5rem;
}
.btn-search-again:hover { background: rgba(255,114,0,0.1); border-color: var(--primary); color: var(--primary); }

.error-card {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    animation: slideUp 0.4s ease;
}
.error-icon { font-size: 3rem; margin-bottom: 1rem; }
.error-title { font-size: 1.1rem; font-weight: 700; color: #ef4444; margin-bottom: 0.5rem; }
.error-msg { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* Footer */
.site-footer {
    position: relative;
    z-index: 10;
    padding: 1.5rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: #4a5568;
    font-size: 0.82rem;
    backdrop-filter: blur(10px);
    background: rgba(5,11,20,0.6);
}

/* Image Modal */
.img-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.img-modal-overlay.active { display: flex; }
.img-modal-content { max-width: 90vw; max-height: 90vh; border-radius: 12px; }
.img-modal-close {
    position: absolute;
    top: 1rem; right: 1rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
}

/* ======================== ADMIN PANEL ======================== */
.admin-body {
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    background: #f0f4f8;
    color: #1e293b;
    min-height: 100vh;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-logo {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: #fff;
}
.sidebar-title { font-size: 0.95rem; font-weight: 700; line-height: 1.3; }
.sidebar-title small { display: block; font-size: 0.72rem; color: #94a3b8; font-weight: 400; }

.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-section { padding: 0.5rem 1rem 0.25rem; font-size: 0.7rem; text-transform: uppercase; color: #475569; letter-spacing: 1px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.88rem;
    border-right: 3px solid transparent;
    position: relative;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active {
    color: var(--primary);
    background: rgba(255,114,0,0.08);
    border-right-color: var(--primary);
    font-weight: 600;
}
.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.82rem;
}
.user-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: #64748b; font-size: 0.72rem; }

/* Admin Main */
.admin-main {
    margin-right: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.admin-topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.topbar-title h1 { font-size: 1.1rem; font-weight: 700; color: #0f172a; }
.topbar-title p { font-size: 0.78rem; color: #64748b; }
.topbar-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Page Content */
.admin-content {
    padding: 1.5rem;
    flex: 1;
}

/* Cards */
.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    overflow: hidden;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.card-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.card-body { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid #e2e8f0; background: #f8fafc; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon.blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.stat-icon.green { background: rgba(16,185,129,0.1); color: #10b981; }
.stat-icon.purple { background: rgba(124,58,237,0.1); color: #7c3aed; }
.stat-icon.orange { background: rgba(245,158,11,0.1); color: #f59e0b; }
.stat-value { font-size: 2rem; font-weight: 800; color: #0f172a; line-height: 1; }
.stat-label { font-size: 0.82rem; color: #64748b; margin-top: 0.25rem; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { background: #f8fafc; padding: 0.75rem 1rem; text-align: right; font-weight: 600; color: #475569; font-size: 0.8rem; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
td { padding: 0.85rem 1rem; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-info { background: #dbeafe; color: #2563eb; }
.badge-secondary { background: #f1f5f9; color: #64748b; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.5;
}
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; border-radius: 6px; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; border-radius: 10px; }
.btn-primary { background: #ff7200; color: #fff; box-shadow: 0 1px 3px rgba(255,114,0,0.3); }
.btn-primary:hover { background: #cc5a00; box-shadow: 0 3px 8px rgba(255,114,0,0.4); }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-outline { background: transparent; border: 1px solid #e2e8f0; color: #475569; }
.btn-outline:hover { background: #f8fafc; }
.btn-cyber { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 2px 10px rgba(255,114,0,0.3); }
.btn-cyber:hover { box-shadow: 0 4px 15px rgba(255,114,0,0.5); }

/* Forms */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: #334155; margin-bottom: 0.4rem; }
.form-label .required { color: #ef4444; margin-right: 0.2rem; }
.form-control, .form-select {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9rem;
    color: #1e293b;
    transition: all 0.2s;
    outline: none;
    direction: rtl;
}
.form-control:focus, .form-select:focus {
    border-color: #ff7200;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255,114,0,0.1);
}
textarea.form-control { min-height: 100px; resize: vertical; }
.form-hint { font-size: 0.78rem; color: #94a3b8; margin-top: 0.3rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* Upload Area */
.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8fafc;
}
.upload-area:hover, .upload-area.dragover { border-color: #ff7200; background: rgba(255,114,0,0.05); }
.upload-area input[type="file"] { display: none; }
.upload-icon { font-size: 2.5rem; margin-bottom: 0.75rem; color: #94a3b8; }
.upload-text { font-size: 0.9rem; color: #475569; }
.upload-hint { font-size: 0.78rem; color: #94a3b8; margin-top: 0.3rem; }

.images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}
.img-preview-item {
    position: relative;
    width: 100px;
}
.img-preview-item img {
    width: 100px; height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}
.img-preview-item .remove-img {
    position: absolute;
    top: -6px; right: -6px;
    width: 20px; height: 20px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
}

/* Alerts */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.875rem;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.btn-close { margin-right: auto; background: none; border: none; cursor: pointer; font-size: 1.1rem; color: inherit; opacity: 0.6; line-height: 1; }
.btn-close:hover { opacity: 1; }

/* Empty State */
.empty-state { text-align: center; padding: 3rem 1rem; color: #94a3b8; }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-text { font-size: 0.95rem; }

/* Admin Login Page */
.admin-login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
}
.login-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(10px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-icon {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.75rem;
    box-shadow: 0 0 30px rgba(255,114,0,0.3);
}
.login-title { font-size: 1.2rem; font-weight: 700; color: #fff; }
.login-sub { font-size: 0.82rem; color: #64748b; }

.login-form .form-label { color: #94a3b8; }
.login-form .form-control {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    color: #fff;
}
.login-form .form-control:focus {
    background: rgba(255,255,255,0.09);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,114,0,0.1);
}
.login-form .form-control::placeholder { color: #475569; }
.btn-login {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255,114,0,0.3);
    margin-top: 0.5rem;
}
.btn-login:hover { box-shadow: 0 6px 25px rgba(255,114,0,0.5); transform: translateY(-1px); }

.login-alert {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: #f87171;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

/* Switch toggle */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 24px;
    transition: 0.3s;
}
.toggle-slider:before {
    content: '';
    position: absolute;
    height: 18px; width: 18px;
    right: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
input:checked + .toggle-slider { background: #10b981; }
input:checked + .toggle-slider:before { transform: translateX(-20px); }

/* Pagination */
.pagination { display: flex; gap: 0.3rem; justify-content: center; }
.page-link {
    padding: 0.4rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #475569;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.page-link.active { background: #ff7200; color: #fff; border-color: #ff7200; }
.page-link:hover:not(.active) { background: #f1f5f9; }

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(100%); transition: transform 0.3s; }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-right: 0; }
    .admin-topbar { padding: 0.75rem 1rem; }
    .admin-content { padding: 1rem; }
}

/* Settings editor */
.color-input-group { display: flex; align-items: center; gap: 0.5rem; }
.color-input-group input[type="color"] {
    width: 40px; height: 38px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Field type badge */
.field-type {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ======================================================
   PUBLIC NAV MENU
====================================================== */
.site-nav { display:flex; align-items:center; gap:0.2rem; }
.nav-menu-item { position:relative; }
.nav-menu-link {
    display:flex; align-items:center; gap:0.35rem;
    color:#94a3b8; text-decoration:none; font-size:0.88rem;
    padding:0.45rem 0.85rem; border-radius:8px;
    transition:all 0.2s; white-space:nowrap;
}
.nav-menu-link:hover { color:#fff; background:rgba(255,255,255,0.06); }
.nav-menu-link .arrow { font-size:0.65rem; transition:transform 0.2s; }
.nav-menu-item:hover .arrow { transform:rotate(180deg); }
.nav-dropdown {
    display:none; position:absolute;
    top:calc(100% + 6px); right:0;
    background:#0f172a; border:1px solid rgba(255,114,0,0.2);
    border-radius:10px; min-width:180px;
    box-shadow:0 8px 30px rgba(0,0,0,0.5);
    z-index:100; overflow:hidden;
}
.nav-menu-item:hover .nav-dropdown { display:block; }
.nav-dropdown a {
    display:block; padding:0.6rem 1rem;
    color:#94a3b8; text-decoration:none; font-size:0.85rem;
    transition:all 0.15s;
}
.nav-dropdown a:hover { background:rgba(255,114,0,0.08); color:#fff; }
.mobile-nav-btn { display:none; background:none; border:1px solid rgba(255,255,255,0.15); color:#94a3b8; border-radius:6px; padding:0.35rem 0.65rem; cursor:pointer; font-size:1.1rem; }
.mobile-nav { display:none; position:absolute; top:70px; right:0; left:0; background:rgba(5,11,20,0.97); border-bottom:1px solid rgba(255,114,0,0.15); padding:1rem; z-index:200; backdrop-filter:blur(10px); }
.mobile-nav.open { display:block; }
.mobile-nav a { display:block; color:#94a3b8; text-decoration:none; padding:0.6rem 0.75rem; border-radius:6px; margin-bottom:2px; font-size:0.9rem; }
.mobile-nav a:hover { color:#fff; background:rgba(255,255,255,0.05); }
.mobile-nav-sub { padding-right:1.25rem; }

/* Theme toggle button */
.theme-toggle {
    display:flex; align-items:center; gap:0.4rem;
    background:rgba(255,255,255,0.06);
    border:1px solid var(--border-color);
    border-radius:20px;
    padding:0.38rem 0.85rem;
    cursor:pointer; font-size:0.82rem;
    color:#94a3b8; transition:all 0.2s;
    white-space:nowrap;
}
.theme-toggle:hover { background:rgba(255,255,255,0.1); color:#e2e8f0; }
.theme-label { font-family:'Vazirmatn',sans-serif; }

/* ======================================================
   LIGHT MODE — صفحه عمومی
====================================================== */
[data-theme="light"] .public-page {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(255,114,0,0.4) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(255,140,0,0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(200,60,0,0.25) 0%, transparent 50%),
        linear-gradient(180deg, #ff6a00 0%, #ee5a00 30%, #d94500 70%, #bf3c00 100%);
    color:#fff;
}
[data-theme="light"] .laser-grid {
    background-image:
        linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.07) 1px, transparent 1px);
}
[data-theme="light"] .laser-line {
    background:linear-gradient(180deg, transparent 0%, rgba(255,220,150,0.5) 50%, transparent 100%);
}
[data-theme="light"] .particle { background:#ffe0a0; opacity:0.5; }
[data-theme="light"] .site-header {
    background:rgba(180,50,0,0.7);
    border-color:rgba(255,200,100,0.3);
}
[data-theme="light"] .logo-icon { background:linear-gradient(135deg,#fff3e0,#ffe0b2); color:#b33000; }
[data-theme="light"] .logo-text { color:#fff; }
[data-theme="light"] .logo-text span { color:rgba(255,220,150,0.85); }
[data-theme="light"] .nav-menu-link { color:rgba(255,240,210,0.85); }
[data-theme="light"] .nav-menu-link:hover { color:#fff; background:rgba(255,255,255,0.12); }
[data-theme="light"] .nav-dropdown { background:#7a2000; border-color:rgba(255,180,80,0.3); box-shadow:0 8px 30px rgba(0,0,0,0.35); }
[data-theme="light"] .nav-dropdown a { color:rgba(255,230,190,0.85); }
[data-theme="light"] .nav-dropdown a:hover { color:#fff; background:rgba(255,255,255,0.1); }
[data-theme="light"] .header-admin-link { color:rgba(255,230,190,0.8); border-color:rgba(255,220,150,0.35); }
[data-theme="light"] .header-admin-link:hover { color:#fff; border-color:rgba(255,255,255,0.5); background:rgba(255,255,255,0.1); }
[data-theme="light"] .theme-toggle { background:rgba(255,255,255,0.12); border-color:rgba(255,220,150,0.3); color:rgba(255,230,190,0.85); }
[data-theme="light"] .theme-toggle:hover { background:rgba(255,255,255,0.2); color:#fff; }
[data-theme="light"] .mobile-nav { background:rgba(150,40,0,0.97); border-color:rgba(255,180,80,0.2); }
[data-theme="light"] .mobile-nav a { color:rgba(255,230,190,0.85); }
[data-theme="light"] .mobile-nav a:hover { color:#fff; background:rgba(255,255,255,0.1); }
[data-theme="light"] .hero-badge { color:#ffe8b0; background:rgba(255,255,255,0.12); border-color:rgba(255,220,150,0.4); }
[data-theme="light"] .hero-title {
    background:linear-gradient(135deg, #fff 0%, #ffe0a0 50%, #ffb347 100%);
    -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
}
[data-theme="light"] .hero-subtitle { color:rgba(255,230,190,0.85); }
[data-theme="light"] .search-card {
    background:rgba(120,35,0,0.55);
    border-color:rgba(255,200,100,0.3);
    box-shadow:0 8px 40px rgba(0,0,0,0.3), 0 2px 12px rgba(0,0,0,0.2);
    backdrop-filter:blur(20px);
}
[data-theme="light"] .search-label { color:rgba(255,230,190,0.85); }
[data-theme="light"] .search-hint { color:rgba(255,210,150,0.6); }
[data-theme="light"] .search-input {
    background:rgba(255,255,255,0.1); border-color:rgba(255,200,100,0.35); color:#fff;
}
[data-theme="light"] .search-input:focus {
    border-color:rgba(255,220,150,0.7); background:rgba(255,255,255,0.15);
    box-shadow:0 0 0 3px rgba(255,200,100,0.2);
}
[data-theme="light"] .search-input::placeholder { color:rgba(255,200,140,0.5); }
[data-theme="light"] .result-card {
    background:rgba(120,35,0,0.55); border-color:rgba(255,200,100,0.25);
    box-shadow:0 4px 20px rgba(0,0,0,0.25); backdrop-filter:blur(20px);
}
[data-theme="light"] .result-status-bar.success { background:rgba(16,185,129,0.2); color:#6ee7b7; border-bottom:1px solid rgba(16,185,129,0.3); }
[data-theme="light"] .result-status-bar.warning { background:rgba(245,158,11,0.2); color:#fcd34d; border-bottom:1px solid rgba(245,158,11,0.3); }
[data-theme="light"] .section-title { color:rgba(255,220,160,0.75); }
[data-theme="light"] .info-item { background:rgba(255,255,255,0.07); border-color:rgba(255,200,100,0.2); }
[data-theme="light"] .info-label { color:rgba(255,220,160,0.7); }
[data-theme="light"] .info-value { color:#fff; }
[data-theme="light"] .info-value .dot { background:#ffb347; }
[data-theme="light"] .serial-badge { background:rgba(255,255,255,0.12); color:#ffe08a; border-color:rgba(255,200,100,0.4); }
[data-theme="light"] .warranty-chip.valid { background:rgba(16,185,129,0.2); color:#6ee7b7; border-color:rgba(16,185,129,0.4); }
[data-theme="light"] .warranty-chip.expired { background:rgba(239,68,68,0.2); color:#fca5a5; border-color:rgba(239,68,68,0.4); }
[data-theme="light"] .device-image-thumb { border-color:rgba(255,200,100,0.3); }
[data-theme="light"] .created-by-note { color:rgba(255,210,150,0.55); border-top-color:rgba(255,200,100,0.15); }
[data-theme="light"] .btn-search-again { color:#ffe08a; border-color:rgba(255,200,100,0.35); }
[data-theme="light"] .btn-search-again:hover { background:rgba(255,255,255,0.1); border-color:rgba(255,220,150,0.6); }
[data-theme="light"] .error-card { background:rgba(239,68,68,0.15); border-color:rgba(239,68,68,0.35); }
[data-theme="light"] .error-icon { filter:none; }
[data-theme="light"] .error-title { color:#fca5a5; }
[data-theme="light"] .error-msg { color:rgba(255,210,180,0.8); }
[data-theme="light"] .site-footer {
    background:rgba(150,40,0,0.7);
    border-color:rgba(255,180,80,0.2);
    color:rgba(255,210,150,0.65);
}

@media(max-width:768px) {
    .site-nav { display:none; }
    .mobile-nav-btn { display:block; }
    .theme-label { display:none; }
}

/* Mobile search layout */
@media (max-width: 640px) {
    .hero-section { padding: 2rem 1rem 3rem; }
    .hero-title { font-size: clamp(1.5rem, 7vw, 2.5rem); }

    /* Header: fix overflow on mobile */
    .site-header {
        padding: 0.65rem 0.75rem;
        flex-wrap: nowrap;
        gap: 0.4rem;
    }
    .site-header > div {
        gap: 0.35rem;
        flex-shrink: 0;
    }

    /* Logo: smaller on mobile */
    .site-logo { gap: 0.5rem; max-width: calc(100% - 160px); overflow: hidden; }
    .logo-icon { width: 90px !important; height: 44px !important; font-size: 0.95rem; border-radius: 8px; flex-shrink: 0; }
    .site-logo img { height: 44px !important; width: auto !important; max-width: 90px; object-fit: contain; }
    .logo-text { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .logo-text span { font-size: 0.65rem; }

    /* Admin link: smaller on mobile */
    .header-admin-link { font-size: 0.72rem; padding: 0.3rem 0.6rem; white-space: nowrap; }

    /* Theme toggle: icon only on mobile */
    .theme-toggle { padding: 0.35rem 0.5rem; }

    /* Mobile nav button */
    .mobile-nav-btn { padding: 0.3rem 0.55rem; font-size: 1rem; }

    /* Mobile nav position */
    .mobile-nav { top: 64px; }

    /* Search card: full width, better spacing */
    .search-card {
        padding: 1.4rem 1rem 1.2rem;
        border-radius: 16px;
        margin: 0;
        width: 100%;
    }
    .search-label { font-size: 0.9rem; margin-bottom: 0.75rem; }

    /* Stack input + button vertically */
    .search-input-group {
        flex-direction: column;
        gap: 0.6rem;
    }
    .search-input {
        text-align: right;
        letter-spacing: 0;
        font-size: 1rem;
        padding: 0.85rem 1rem;
        border-radius: 10px;
    }
    .search-btn {
        width: 100%;
        justify-content: center;
        padding: 0.9rem 1rem;
        font-size: 1rem;
        border-radius: 10px;
    }
    .search-hint { font-size: 0.8rem; margin-top: 0.5rem; }

    /* Result card on mobile */
    .result-card { border-radius: 14px; }
    .result-body { padding: 1rem; }
    .device-info-grid { gap: 0.6rem; }
    .info-item { padding: 0.7rem 0.85rem; }
}
@media (max-width: 400px) {
    .search-card { padding: 1.1rem 0.8rem; }
    .hero-section { padding: 1.5rem 0.65rem 2rem; }
    .site-header { padding: 0.55rem 0.6rem; }
    .logo-icon { width: 76px !important; height: 38px !important; }
    .site-logo img { height: 38px !important; max-width: 76px; }
    .header-admin-link { display: none; }
}

/* Hide Replit badge */
#replit-badge,
.replit-ui-theme-root,
[data-replit-badge],
iframe[src*="replit.com/badge"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
