@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap');

:root {
    --bg-color: #f0f2f5;
    /* Subtle gray background */
    --card-bg: #ffffff;
    --input-bg: #f8f9fa;
    --border-color: #dee2e6;
    --text-primary: #1a1b1e;
    --text-secondary: #5f6368;
    --primary-color: #1a73e8;
    --primary-gradient: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    --danger-color: #d93025;
    --success-color: #1e8e3e;
    --star-color: #fbbc04;
    --glass-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:root.dark-mode {
    --bg-color: #0a0a0a;
    --card-bg: #171717;
    --input-bg: #262626;
    --border-color: #333333;
    --text-primary: #ededed;
    --text-secondary: #a3a3a3;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

:root.dark-mode header {
    background: rgba(10, 10, 10, 0.95) !important;
    border-bottom: 1px solid var(--border-color);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Background effects */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 10%, rgba(26, 115, 232, 0.02) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(26, 115, 232, 0.02) 0%, transparent 40%);
    z-index: -1;
    pointer-events: none;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    background: rgba(128, 128, 128, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(128, 128, 128, 0.15);
    color: var(--primary-color);
    transform: rotate(15deg);
}

:root.dark-mode .theme-toggle {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn {
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: #1f6feb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(31, 111, 235, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.hidden {
    display: none !important;
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

.user-avatar:hover {
    transform: scale(1.05);
}

.user-dropdown-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 220px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    z-index: 1000;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-dropdown-header {
    padding: 12px 16px;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    text-align: right;
}

.user-dropdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.user-dropdown-list li {
    padding: 0;
}

.user-dropdown-list a,
.dropdown-item-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition);
    font-size: 0.95rem;
    width: 100%;
    text-align: right;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.user-dropdown-list a:hover,
.dropdown-item-btn:hover {
    background: var(--hover-color);
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.dropdown-item-btn {
    color: var(--danger-color);
}

.dropdown-item-btn:hover {
    color: var(--danger-color);
    background: rgba(231, 76, 60, 0.1);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Apps Grid */
.section-title {
    font-size: 2rem;
    margin: 3rem 0 2rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding-bottom: 4rem;
}

.app-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--card-shadow);
}

.app-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--primary-color);
}

.app-header {
    display: flex;
    gap: 15px;
    align-items: center;
}

.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    object-fit: cover;
    background: transparent;
}

.app-info h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.app-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.app-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--star-color);
    font-size: 0.9rem;
}

.app-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.version-badge {
    background: rgba(88, 166, 255, 0.1);
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.install-count {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.install-count i {
    color: var(--success-color);
}

/* Screenshots Gallery */
.app-screenshots-section {
    margin-bottom: 2rem;
}

.screenshots-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.screenshots-container {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar */
    scrollbar-width: none;
}

.screenshots-container::-webkit-scrollbar {
    display: none;
}

/* Arrow Buttons */
.scroll-arrow {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: var(--card-shadow);
    z-index: 2;
}

.scroll-arrow:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    transform: scale(1.1);
}

.screenshot-img {
    height: 350px;
    border-radius: 12px;
    object-fit: cover;
    scroll-snap-align: start;
    box-shadow: var(--glass-shadow);
    background-color: var(--card-bg);
    cursor: pointer;
    transition: var(--transition);
}

.screenshot-img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Lightbox Modal */
.modal-lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    z-index: 2001;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .screenshot-img {
        height: 250px;
    }
}

/* Loading Spinner */
.loader {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-bottom-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    margin: 50px auto;
}

.loader-container {
    text-align: center;
    width: 100%;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* File Upload UI */
.file-upload-wrapper {
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: var(--transition);
    margin: 12px 0;
}

.file-upload-wrapper:hover {
    border-color: var(--primary-color);
    background: var(--card-bg);
}

.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
}

.preview-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.file-info-text {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
    margin-top: 4px;
    /* for labels without form-group separation */
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.1);
}

/* Stylish Dropdown Options */
select.form-control option {
    font-family: inherit;
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    margin: 4px;
    font-weight: 500;
}

/* Custom Select Dropdown UI */
.custom-select-container {
    position: relative;
    width: 100%;
    margin-top: 4px;
}

.custom-select-trigger {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    font-weight: 500;
}

.custom-select-trigger:hover {
    border-color: var(--primary-color);
}

.custom-select-trigger.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.1);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin-top: 8px;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    scrollbar-width: thin;
}

.custom-select-container.open .custom-select-options {
    display: block;
    animation: slideDown 0.2s ease forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-select-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover,
.custom-select-option.selected {
    background-color: rgba(26, 115, 232, 0.05);
    color: var(--primary-color);
    padding-right: 20px;
}

/* Notifications UI */
.notif-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.notif-bell {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    position: relative;
    padding: 5px;
    margin-left: 10px;
}

.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-dropdown {
    position: absolute;
    top: 100%;
    left: -100px;
    /* Align nicely */
    width: 300px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    z-index: 1000;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
}

.notif-header {
    padding: 15px;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.notif-list {
    max-height: 300px;
    overflow-y: auto;
}

.notif-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    text-align: right;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--bg-color);
}

.notif-item.unread {
    background: rgba(88, 166, 255, 0.08);
}

.notif-item h4 {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
}

.notif-item p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notif-item .notif-date {
    display: block;
    margin-top: 5px;
    font-size: 0.75rem;
    color: #888;
}

/* Admin Categories List Styles */
.admin-categories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    transition: var(--transition);
}

.category-list-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-color);
}

.category-list-item .cat-name {
    font-weight: bold;
    color: var(--text-primary);
    font-size: 1rem;
}

.category-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.edit-btn {
    color: var(--primary-color);
}

.btn-icon.edit-btn:hover {
    background: rgba(26, 115, 232, 0.1);
}

.btn-icon.delete-btn {
    color: var(--danger-color);
}

.btn-icon.delete-btn:hover {
    background: rgba(234, 67, 53, 0.1);
}