/* ============================================
   Layout & Structure
   ============================================ */

/* Header Styles */
.header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    background: rgba(7, 11, 24, 0.88);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    padding: 18px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.28);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header h1, .brand-title {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.75px;
}

.header .subtitle {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
    font-weight: 400;
    margin: 0;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-image {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    padding: 6px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.navbar {
    direction: ltr;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 18px;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-self: center;
    flex-wrap: wrap;
    direction: rtl;
}

.nav-link {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
    transition: color 0.25s ease, transform 0.25s ease;
}

.nav-link:hover,
.nav-link:focus {
    color: #c1c7ff;
    transform: translateY(-1px);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-self: end;
}

/* Hamburger (mobile) */
.hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    padding: 6px;
}
.hamburger .hamburger-box {
    width: 28px;
    height: 18px;
    display: inline-block;
    position: relative;
}
.hamburger .hamburger-inner,
.hamburger .hamburger-inner::before,
.hamburger .hamburger-inner::after {
    width: 100%;
    height: 2px;
    background-color: #fff;
    display: block;
    border-radius: 2px;
    position: absolute;
    left: 0;
    transition: transform 0.25s ease, opacity 0.2s ease;
}
.hamburger .hamburger-inner {
    top: 50%;
    transform: translateY(-50%);
}
.hamburger .hamburger-inner::before {
    content: '';
    top: -8px;
}
.hamburger .hamburger-inner::after {
    content: '';
    top: 8px;
}
.hamburger.is-active .hamburger-inner {
    transform: rotate(45deg);
}
.hamburger.is-active .hamburger-inner::before {
    transform: rotate(90deg) translateX(0);
    top: 0;
}
.hamburger.is-active .hamburger-inner::after {
    opacity: 0;
}

/* Mobile navigation panel */
.mobile-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(7,11,24,0.98);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.45);
    padding: 14px 18px 20px;
    z-index: 30;
}
.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mobile-nav-link {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    color: rgba(255,255,255,0.94);
    text-decoration: none;
    font-weight: 700;
}
.mobile-nav-link:hover {
    background: rgba(255,255,255,0.03);
}

/* Prevent body scroll when menu open */
.no-scroll {
    overflow: hidden !important;
}

.nav-action-button,
.nav-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.nav-action-button {
    background: rgba(255, 255, 255, 0.08);
    color: #f8faff;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-action-button:hover,
.nav-action-button:focus {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.nav-link-button {
    background: rgba(255, 255, 255, 0.08);
    color: #f8faff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-link-button.nav-primary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(168, 85, 247, 0.95));
    color: white;
    border-color: transparent;
    box-shadow: 0 14px 40px rgba(99, 102, 241, 0.24);
}

body.dark-mode .navbar {
    background: rgba(7, 11, 24, 0.94);
}

body.dark-mode .nav-action-button,
body.dark-mode .nav-link-button {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    position: relative;
    padding-bottom: 60px;
    background: transparent;
}

.content-wrapper {
    width: 100%;
    padding: 30px 5vw 60px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 30px;
}

/* Hero Section */
.input-panel {
    position: relative;
    overflow: visible;
    padding: 70px 48px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    width: min(1120px, 100%);
    margin: 8vh auto 0;
    min-height: 52vh;
    text-align: center;
    background: transparent;
    border: none;
    box-shadow: none;
}

.input-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 20%, rgba(120, 95, 255, 0.12), transparent 20%), radial-gradient(circle at 85% 35%, rgba(35, 199, 255, 0.10), transparent 18%);
    pointer-events: none;
    opacity: 0.65;
    filter: blur(18px);
}

.input-panel::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    top: 18%;
    right: -6%;
    filter: blur(12px);
    pointer-events: none;
}

.input-panel h2 {
    position: relative;
    z-index: 1;
    color: #f8fbff;
    font-size: clamp(2rem, 3.2vw, 3.2rem);
    margin: 0;
    line-height: 1.05;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-shadow: 0 18px 45px rgba(45, 80, 255, 0.14);
}

.input-panel .subtitle-text {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, 0.75);
    font-size: clamp(1rem, 1.1vw, 1.1rem);
    max-width: 760px;
    margin: 0 auto 32px;
    line-height: 1.8;
    letter-spacing: 0.02em;
}

/* Preview Panel */
.preview-panel,
.result-panel,
.download-status-panel {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 12, 28, 0.92);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-radius: 28px;
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.22);
}

.preview-panel {
    padding: 28px 24px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    width: min(920px, 100%);
    max-width: 920px;
    min-height: auto;
    margin: -70px auto 0;
    z-index: 1;
    align-items: start;
}

.preview-panel h2,
.result-panel h2 {
    color: #e8efff;
    font-size: 1.4rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: none;
    padding-bottom: 0;
    grid-column: 1 / -1;
}

#previewContent {
    text-align: right;
    line-height: 1.6;
    max-width: 100%;
    color: rgba(255, 255, 255, 0.82);
}

.preview-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 45px rgba(7, 12, 31, 0.28);
}

.preview-card-thumbnail,
.preview-card-body,
.preview-card-row {
    color: #e8efff;
}

.preview-card-thumbnail img {
    width: 140px;
    height: auto;
    display: block;
    border-radius: 16px;
    object-fit: cover;
}

.preview-card-body {
    flex: 1 1 auto;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-card-label,
.preview-card-value {
    color: rgba(255, 255, 255, 0.84);
}

.preview-card-label {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.preview-card-value {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    max-height: 3.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.preview-card-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.78);
}

.preview-card-badge {
    align-self: flex-start;
    padding: 8px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    color: #f5f7ff;
    font-size: 0.85rem;
    max-width: fit-content;
}

.mobile-preview-info {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    padding: 16px 18px;
    border-radius: 20px;
    display: none;
    gap: 10px;
}

.mobile-preview-info .mobile-preview-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.95rem;
}

.mobile-preview-info .mobile-preview-row span {
    color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 640px) {
    .preview-panel {
        padding: 28px 20px;
        margin-top: 0;
    }

    .preview-card {
        flex-direction: column;
        align-items: stretch;
    }

    .preview-card-thumbnail img {
        width: 100%;
        height: auto;
        max-height: 240px;
    }

    .mobile-preview-info {
        display: grid;
    }

    #previewContent {
        display: none;
    }

    .download-status-panel {
        display: none !important;
    }
}

.result-panel {
    padding: 42px 34px;
    width: min(1080px, 100%);
    margin: 0 auto;
}

.result-panel h2 {
    color: #f8fbff;
    font-size: 1.6rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.22);
    padding-bottom: 16px;
}

/* Supported Sites Section */
.supported-sites-section {
    width: 100%;
    background: linear-gradient(180deg, rgba(6,12,28,0.02), rgba(6,12,28,0.02));
    padding: 44px 20px;
    margin-top: -30px; /* رفع القسم قليلاً فوق المحتوى السابق */
}
.supported-inner {
    max-width: 1200px; /* تكبير اللوحة قليلاً */
    margin: 0 auto;
    transform: translateY(-8px);
}
.supported-sites-section h2 {
    font-size: 1.4rem;
    margin: 0 auto 6px auto;
    color: #e8efff;
    text-align: center;
}
.supported-sub {
    color: rgba(255,255,255,0.7);
    margin: 6px 0 18px 0;
}
.supported-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}
.supported-search {
    flex: 1 1 auto;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    color: #fff;
}
.supported-refresh {
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    background: #2f5cff;
    color: #fff;
    cursor: pointer;
}
.supported-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

@media (max-width: 992px) {
    .supported-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .supported-grid {
        grid-template-columns: 1fr;
    }
}
.supported-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px; /* تكبير البطاقة */
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
    text-align: center;
    min-height: 140px;
}
.supported-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}
.supported-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg,#5b6bff,#52c41a);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
}
.supported-name {
    font-size: 1rem;
    color: rgba(255,255,255,0.95);
}

