/* ============================================
   Fix Hub - Pro Design System v2.0
   ============================================ */

:root {
    --bg-primary: #05070d;
    --bg-secondary: #0a0e1a;
    --bg-card: rgba(15, 21, 38, 0.72);
    --bg-card-hover: rgba(20, 28, 50, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(56, 189, 248, 0.35);
    
    --accent-sky: #38bdf8;
    --accent-blue: #2563eb;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-purple: #a855f7;
    --accent-rose: #f43f5e;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --grad-primary: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
    --grad-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --grad-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --grad-purple: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(56, 189, 248, 0.25);
}

* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 80px; /* مساحة للـ bottom nav */
}

/* ===== Ambient Background Glow ===== */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: ambientFloat 25s ease-in-out infinite;
}

@keyframes ambientFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-3%, -3%) rotate(2deg); }
}

/* ===== Glass Card ===== */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border-subtle);
    position: relative;
    z-index: 1;
}

.glass-strong {
    background: rgba(10, 14, 26, 0.92);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== Header ===== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 14px 16px;
    background: rgba(5, 7, 13, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
}

.app-header-inner {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo-box {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: var(--grad-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 20px;
    color: white;
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
    position: relative;
    overflow: hidden;
}

.logo-box::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
    transform: translateX(-100%);
    animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

/* ===== Card Base ===== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 20px;
    position: relative;
    z-index: 1;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-interactive {
    cursor: pointer;
    overflow: hidden;
}

.card-interactive::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--grad-primary);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.card-interactive:hover {
    border-color: var(--border-glow);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.card-interactive:active {
    transform: translateY(-1px) scale(0.99);
}

/* ===== Stat Card ===== */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 12px 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--grad-primary);
    opacity: 0.6;
}

.stat-value {
    font-size: 20px;
    font-weight: 900;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ===== Icon Box ===== */
.icon-box {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    position: relative;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
}

.icon-box-sky { background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(37, 99, 235, 0.08)); border: 1px solid rgba(56, 189, 248, 0.25); }
.icon-box-emerald { background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.08)); border: 1px solid rgba(16, 185, 129, 0.25); }
.icon-box-amber { background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.08)); border: 1px solid rgba(245, 158, 11, 0.25); }
.icon-box-purple { background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(124, 58, 237, 0.08)); border: 1px solid rgba(168, 85, 247, 0.25); }
.icon-box-indigo { background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(79, 70, 229, 0.08)); border: 1px solid rgba(99, 102, 241, 0.25); }

.card-interactive:hover .icon-box {
    transform: scale(1.12) rotate(-5deg);
}

/* ===== Brand Tile ===== */
.brand-tile {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.brand-tile::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.brand-tile:hover {
    border-color: var(--border-glow);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.brand-tile:hover::before {
    opacity: 1;
}

.brand-tile .brand-emoji {
    font-size: 26px;
    position: relative;
    z-index: 1;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-tile:hover .brand-emoji {
    transform: scale(1.2);
}

.brand-tile .brand-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.brand-tile .brand-count {
    font-size: 9px;
    color: var(--accent-sky);
    font-weight: 700;
    position: relative;
    z-index: 1;
}

/* ===== Model Card (الفخم) ===== */
.model-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border-subtle);
    border-radius: 22px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cardFadeIn 0.5s ease forwards;
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.model-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 3px;
    background: var(--grad-primary);
    border-radius: 0 22px 22px 0;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.model-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.model-card:hover::before {
    opacity: 1;
}

/* ===== Device Image Frame ===== */
.device-frame {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(5, 7, 13, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

.device-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), transparent 60%);
    pointer-events: none;
}

.device-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
    transition: transform 0.4s ease;
    position: relative;
    z-index: 1;
}

.model-card:hover .device-frame img {
    transform: scale(1.08);
}

/* ===== Chips ===== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 11px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.2);
    font-size: 11px;
    font-weight: 700;
    color: #bae6fd;
    transition: all 0.2s ease;
}

.chip::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-sky);
    box-shadow: 0 0 8px var(--accent-sky);
}

.chip:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.4);
}

.chip-type {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(37, 99, 235, 0.08));
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--accent-sky);
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 9px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

/* ===== Notes Box ===== */
.notes-box {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(217, 119, 6, 0.04));
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 11px;
    color: #fcd34d;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.6;
    margin-top: 10px;
}

.notes-box span:last-child {
    color: #fef3c7;
}

/* ===== Search Input ===== */
.search-input {
    width: 100%;
    background: rgba(15, 21, 38, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 14px 16px 14px 44px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(12px);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-sky);
    background: rgba(15, 21, 38, 0.95);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
    transition: color 0.3s ease;
}

.search-input:focus + .search-icon,
.search-wrapper:focus-within .search-icon {
    color: var(--accent-sky);
}

/* ===== Select ===== */
.select-input {
    width: 100%;
    background: rgba(15, 21, 38, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    padding-left: 40px;
}

.select-input:focus {
    outline: none;
    border-color: var(--accent-sky);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

/* ===== Button ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--grad-primary);
    color: white;
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(56, 189, 248, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.25), transparent 50%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.btn-primary:hover::before {
    transform: translateX(100%);
}

.btn-ghost {
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-ghost:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--border-glow);
}

/* ===== Back Button ===== */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    color: var(--text-primary);
    border-color: var(--border-glow);
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 10px 16px 16px;
    background: rgba(5, 7, 13, 0.85);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border-top: 1px solid var(--border-subtle);
}

.bottom-nav-inner {
    max-width: 640px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item .nav-icon {
    font-size: 20px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent-sky);
}

.nav-item.active {
    background: rgba(56, 189, 248, 0.1);
}

.nav-item.active .nav-icon {
    transform: scale(1.15) translateY(-2px);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--grad-primary);
    border-radius: 0 0 4px 4px;
}

/* ===== Hero Banner ===== */
.hero {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(168, 85, 247, 0.08));
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.25), transparent 70%);
    filter: blur(40px);
    pointer-events: none;
    animation: heroGlow 8s ease-in-out infinite;
}

@keyframes heroGlow {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-20px, 20px) scale(1.1); }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #fff 0%, #bae6fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

/* ===== Section Title ===== */
.section-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-right: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--grad-primary);
    border-radius: 4px;
}

/* ===== Empty State ===== */
.empty-state {
    padding: 40px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
    opacity: 0.5;
}

/* ===== Skeleton Loader ===== */
.skeleton {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.4) 25%, rgba(51, 65, 85, 0.6) 50%, rgba(30, 41, 59, 0.4) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: 12px;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.badge-sky {
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent-sky);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-live {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-live::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

/* ===== Ad Banner ===== */
.ad-banner {
    max-width: 640px;
    margin: 20px auto;
    padding: 16px;
    background: rgba(10, 14, 26, 0.6);
    border: 1px dashed rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ===== Container ===== */
.container-app {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    position: relative;
    z-index: 1;
}

/* ===== Utility ===== */
.text-gradient {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Responsive ===== */
@media (max-width: 400px) {
    .brand-tile { padding: 12px 4px; }
    .brand-tile .brand-emoji { font-size: 22px; }
    .brand-tile .brand-name { font-size: 10px; }
    .device-frame { width: 56px; height: 56px; }
    .hero-title { font-size: 18px; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.5);
}