/* ===== CSS VARIABLES & THEMES ===== */
:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --accent: #4895ef;
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.1);
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
}

/* Theme 1: Ocean Blue (Default) */
[data-theme="ocean"] {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --accent: #4895ef;
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
}

/* Theme 2: Dark Night */
[data-theme="dark"] {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --accent: #a78bfa;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* Theme 3: Forest Green */
[data-theme="forest"] {
    --primary: #2d6a4f;
    --secondary: #1b4332;
    --accent: #40916c;
    --bg-primary: #d8f3dc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #b7e4c7;
    --text-primary: #081c15;
    --text-secondary: #2d6a4f;
}

/* Theme 4: Sunset Orange */
[data-theme="sunset"] {
    --primary: #f77f00;
    --secondary: #d62828;
    --accent: #fcbf49;
    --bg-primary: #fff5e4;
    --bg-secondary: #ffffff;
    --bg-tertiary: #ffe5d9;
    --text-primary: #2b2d42;
    --text-secondary: #6d6875;
}

/* Theme 5: Purple Dream */
[data-theme="purple"] {
    --primary: #7b2cbf;
    --secondary: #5a189a;
    --accent: #9d4edd;
    --bg-primary: #f3e5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e1bee7;
    --text-primary: #2d1b4e;
    --text-secondary: #5b3a7a;
}

/* Theme 6: Minimal White */
[data-theme="minimal"] {
    --primary: #000000;
    --secondary: #333333;
    --accent: #666666;
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f0f0f0;
    --text-primary: #000000;
    --text-secondary: #555555;
    --border: #dddddd;
}

/* Theme 7: Cyberpunk */
[data-theme="cyberpunk"] {
    --primary: #00f5ff;
    --secondary: #ff00ff;
    --accent: #ffff00;
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #00f5ff;
    --text-secondary: #e94560;
    --shadow: rgba(0, 245, 255, 0.2);
}

/* Theme 8: Rose Gold */
[data-theme="rose"] {
    --primary: #b76e79;
    --secondary: #d4a5a5;
    --accent: #e8c4c4;
    --bg-primary: #fff5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #ffe4e4;
    --text-primary: #4a3737;
    --text-secondary: #8b6b6b;
}

/* Theme 9: Sky Blue */
[data-theme="sky"] {
    --primary: #00b4d8;
    --secondary: #0077b6;
    --accent: #90e0ef;
    --bg-primary: #e0f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #b2ebf2;
    --text-primary: #006064;
    --text-secondary: #00838f;
}

/* Theme 10: High Contrast */
[data-theme="contrast"] {
    --primary: #ffff00;
    --secondary: #00ffff;
    --accent: #ff00ff;
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #333333;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border: #555555;
}

/* ===== BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    line-height: 1.6;
}

/* ===== HEADER ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.logo i {
    font-size: 1.8rem;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    width: 400px;
    max-width: 100%;
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.search-bar button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    transition: transform 0.2s;
}

.search-bar button:hover {
    transform: scale(1.1);
}

.header-icons {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: var(--bg-tertiary);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-primary);
    transition: all 0.3s;
}

.icon-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== FILTERS ===== */
.category-filter, .platform-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn, .platform-btn {
    padding: 0.7rem 1.5rem;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.filter-btn:hover, .platform-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active, .platform-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== CONTENT GRID ===== */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.content-card {
    background: var(--bg-secondary);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow);
}

.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg-tertiary);
}

.card-body {
    padding: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-official {
    background: var(--success);
    color: white;
}

.badge-cracked {
    background: var(--danger);
    color: white;
}

.badge-mod {
    background: var(--warning);
    color: white;
}

.badge-platform {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.download-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.download-btn:hover {
    background: var(--secondary);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}

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

.modal {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

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

.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--secondary);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--border);
}

.form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* ===== ADMIN PANEL ===== */
.admin-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.admin-nav-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.admin-nav-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.admin-panel {
    display: none;
}

.admin-panel.active {
    display: block;
}

.image-preview {
    margin-top: 0.5rem;
    max-width: 200px;
    border-radius: 10px;
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    display: block;
}

/* ===== MANAGE LIST ===== */
.manage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.manage-list {
    max-height: 400px;
    overflow-y: auto;
}

.manage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

.manage-item-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.manage-item-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.manage-item-actions {
    display: flex;
    gap: 0.5rem;
}

.delete-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* ===== THEME GRID ===== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.theme-option {
    padding: 1rem;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    border: 3px solid transparent;
    transition: all 0.3s;
}

.theme-option:hover {
    transform: scale(1.05);
}

.theme-option.active {
    border-color: var(--primary);
}

/* ===== LANGUAGE OPTIONS ===== */
.lang-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lang-btn {
    padding: 1rem;
    border: 2px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-btn:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 1rem;
    }
    
    .search-bar {
        width: 100%;
        order: 3;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .theme-grid {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 1rem;
    }
}

/* RTL Support for Arabic */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .header-icons {
    flex-direction: row-reverse;
}