/* ============================================
   MonApp - Mona Apps Store
   Professional CSS Stylesheet
   ============================================ */

/* === CSS Variables === */
:root {
    --primary: #6C63FF;
    --primary-dark: #5a52d5;
    --primary-light: #8b85ff;
    --secondary: #3F3D56;
    --accent: #FF6584;
    --bg-dark: #0a0a1a;
    --bg-card: #12122a;
    --bg-card-hover: #1a1a3e;
    --bg-surface: #16163a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-muted: #6b6b8d;
    --border: #2a2a50;
    --success: #2ed573;
    --warning: #ffa502;
    --danger: #ff4757;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
}

/* === Container === */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === Navigation === */
.navbar {
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0 0;
}

.navbar .container {
    display: flex;
    align-items: center;
    height: 68px;
    gap: 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    flex-shrink: 0;
}

.brand-icon {
    font-size: 1.6rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-text {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-search {
    flex: 1;
    max-width: 480px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 50px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.nav-link svg {
    width: 16px;
    height: 16px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.mobile-toggle svg {
    width: 24px;
    height: 24px;
}

/* === Main Content === */
.main-content {
    min-height: calc(100vh - 68px - 300px);
    padding: 0 0 40px;
}

/* === Hero Section === */
.hero {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(108, 99, 255, 0.15), transparent 70%);
    border-radius: 50%;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 101, 132, 0.1), transparent 70%);
    border-radius: 50%;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero h1 span {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.hero-search {
    max-width: 500px;
    margin: 0 auto;
}

.hero-search .search-box input {
    padding: 14px 20px 14px 50px;
    font-size: 1rem;
    background: rgba(22, 22, 58, 0.8);
    border: 1px solid rgba(108, 99, 255, 0.3);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 40px;
}

.hero-stat {
    text-align: center;
}

.hero-stat .number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-light);
}

.hero-stat .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === Section Styles === */
.section {
    padding: 40px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

.section-header .view-all {
    color: var(--primary);
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-header .view-all:hover {
    color: var(--primary-light);
}

/* === App Grid === */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.app-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

/* === App Card === */
.app-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.app-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.app-card .app-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: cover;
    margin-bottom: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.app-card .app-icon-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 14px;
}

.app-card .app-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-card .app-category {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.app-card .app-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.app-card .app-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-card .app-meta svg {
    width: 12px;
    height: 12px;
}

.app-card .featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--warning), #ff6348);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === Featured Banner === */
.featured-banner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.featured-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-surface) 100%);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.featured-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.featured-card .app-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.featured-card .app-icon-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.featured-card .app-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.featured-card .app-info .category-tag {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--primary-light);
    background: rgba(108, 99, 255, 0.15);
    padding: 3px 10px;
    border-radius: 50px;
    margin-bottom: 8px;
}

.featured-card .app-info .description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-card .app-meta {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.featured-card .app-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.featured-card .app-meta svg {
    width: 13px;
    height: 13px;
}

/* === Category Cards === */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.category-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    transition: var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
}

.category-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.category-card .cat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.category-card .cat-icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
}

.category-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.category-card .count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === App Detail Page === */
.app-detail {
    padding-top: 30px;
}

.app-header {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 30px;
}

.app-header .icon-large {
    width: 120px;
    height: 120px;
    border-radius: 28px;
    object-fit: cover;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    flex-shrink: 0;
}

.app-header .icon-large-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.app-header .app-title-group h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.app-header .developer {
    font-size: 0.95rem;
    color: var(--primary-light);
    margin-bottom: 8px;
}

.app-header .app-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    padding: 5px 12px;
    border-radius: 50px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.badge svg {
    width: 13px;
    height: 13px;
}

.badge.cat-badge {
    background: rgba(108, 99, 255, 0.15);
    color: var(--primary-light);
    border-color: rgba(108, 99, 255, 0.3);
}

/* === Download Button === */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 14px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4);
    text-decoration: none;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(108, 99, 255, 0.5);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.btn-download svg {
    width: 20px;
    height: 20px;
}

.btn-download .dl-size {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.8;
}

/* === App Stats Row === */
.app-stats-row {
    display: flex;
    gap: 0;
    margin: 30px 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.app-stat {
    flex: 1;
    text-align: center;
    padding: 20px;
    border-right: 1px solid var(--border);
}

.app-stat:last-child {
    border-right: none;
}

.app-stat .value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.app-stat .value svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.app-stat .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === Stars === */
.stars {
    display: inline-flex;
    gap: 2px;
}

.stars .star {
    width: 15px;
    height: 15px;
    color: var(--text-muted);
}

.stars .star.filled {
    color: var(--warning);
    fill: var(--warning);
}

.stars .star.half {
    color: var(--warning);
}

/* === Screenshots === */
.screenshots-section {
    margin: 30px 0;
}

.screenshots-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 10px 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.screenshots-scroll::-webkit-scrollbar {
    height: 6px;
}

.screenshots-scroll::-webkit-scrollbar-track {
    background: var(--bg-surface);
    border-radius: 3px;
}

.screenshots-scroll::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.screenshot-img {
    height: 320px;
    border-radius: var(--radius);
    object-fit: cover;
    scroll-snap-align: start;
    flex-shrink: 0;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.screenshot-img:hover {
    transform: scale(1.02);
    border-color: var(--primary);
}

/* === Description === */
.app-description {
    margin: 30px 0;
}

.app-description h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.app-description .desc-content {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.95rem;
}

.app-description .desc-content p {
    margin-bottom: 12px;
}

/* === App Info Table === */
.app-info-table {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    margin: 30px 0;
}

.app-info-table h2 {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.info-row {
    display: flex;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .info-label {
    width: 160px;
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.info-row .info-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* === Breadcrumb === */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .separator {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* === Search Results === */
.search-header {
    padding: 30px 0 10px;
}

.search-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.search-header .result-count {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* === Category Page === */
.category-header {
    padding: 40px 0 10px;
    text-align: center;
}

.category-header .cat-icon-large {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.category-header .cat-icon-large svg {
    width: 32px;
    height: 32px;
    color: #fff;
}

.category-header h1 {
    font-size: 2rem;
    font-weight: 800;
}

.category-header .count {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* === All Categories Page === */
.categories-page {
    padding-top: 30px;
}

.categories-page h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 24px;
    text-align: center;
}

/* === App List (Horizontal) === */
.app-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.app-list-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
}

.app-list-item .app-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
}

.app-list-item .app-icon-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.app-list-item .app-info {
    flex: 1;
    min-width: 0;
}

.app-list-item .app-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-list-item .app-category {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.app-list-item .app-dl {
    text-align: right;
    flex-shrink: 0;
}

.app-list-item .app-dl .dl-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-list-item .app-dl .dl-count svg {
    width: 12px;
    height: 12px;
}

.app-list-item .btn-dl-sm {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    padding: 6px 16px;
    background: var(--primary);
    color: #fff;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
}

.app-list-item .btn-dl-sm:hover {
    background: var(--primary-light);
}

.app-list-item .btn-dl-sm svg {
    width: 12px;
    height: 12px;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* === Footer === */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 50px 0 0;
    margin-top: 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

.footer-brand h3 {
    font-size: 1.3rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

.footer-links h4,
.footer-stats h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-links a {
    display: block;
    color: var(--text-muted);
    padding: 4px 0;
    font-size: 0.88rem;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 10px;
}

.footer-stats .stat-item svg {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Screenshot Modal === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.modal-overlay.active {
    display: flex;
}

.modal-overlay img {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 12px;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--bg-surface);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* === Alerts === */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(46, 213, 115, 0.15);
    color: var(--success);
    border: 1px solid rgba(46, 213, 115, 0.3);
}

.alert-error {
    background: rgba(255, 71, 87, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.alert-warning {
    background: rgba(255, 165, 2, 0.15);
    color: var(--warning);
    border: 1px solid rgba(255, 165, 2, 0.3);
}

/* ============================================
   ADMIN PANEL STYLES
   ============================================ */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.admin-sidebar .sidebar-brand {
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.admin-sidebar .sidebar-brand h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-sidebar .sidebar-brand small {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 4px;
}

.admin-sidebar .nav-section {
    padding: 0 12px;
    margin-bottom: 8px;
}

.admin-sidebar .nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 8px 12px;
    font-weight: 700;
}

.admin-sidebar .sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.admin-sidebar .sidebar-link:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.admin-sidebar .sidebar-link.active {
    background: rgba(108, 99, 255, 0.15);
    color: var(--primary-light);
}

.admin-sidebar .sidebar-link svg {
    width: 18px;
    height: 18px;
}

.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.admin-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
}

/* === Admin Dashboard Stats === */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.admin-stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-stat-card .stat-icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
}

.admin-stat-card .stat-info h3 {
    font-size: 1.6rem;
    font-weight: 800;
}

.admin-stat-card .stat-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === Admin Table === */
.admin-table-wrap {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.admin-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.admin-table-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.admin-table td {
    padding: 14px 20px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: rgba(108, 99, 255, 0.05);
}

.admin-table .app-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-table .app-cell img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

.admin-table .app-cell .mini-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background: rgba(46, 213, 115, 0.15);
    color: var(--success);
}

.status-inactive {
    background: rgba(255, 71, 87, 0.15);
    color: var(--danger);
}

.status-featured {
    background: rgba(255, 165, 2, 0.15);
    color: var(--warning);
}

/* === Admin Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #ff6b81;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.action-btns {
    display: flex;
    gap: 6px;
}

/* === Admin Form === */
.admin-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 30px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--primary-light);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group label .required {
    color: var(--accent);
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b6b8d' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.file-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload:hover {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.05);
}

.file-upload svg {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.file-upload p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.file-upload input[type="file"] {
    display: none;
}

.current-file {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.current-file img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

/* === Checkbox Toggle === */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
    border-color: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: #fff;
}

/* === Login Page === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    padding: 20px;
}

.login-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-box .logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-box .logo h1 {
    font-size: 2rem;
}

.login-box .logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-box .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 1rem;
    border-radius: 12px;
    margin-top: 8px;
}

.login-box .back-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-box .back-link:hover {
    color: var(--primary);
}

/* === Responsive === */
@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }

    .admin-sidebar {
        width: 220px;
    }

    .admin-main {
        margin-left: 220px;
    }
}

@media (max-width: 768px) {
    .navbar .container {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 20px;
        gap: 10px;
    }

    .nav-search {
        order: 3;
        max-width: 100%;
        width: 100%;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 68px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        padding: 12px;
        flex-direction: column;
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-toggle {
        display: block;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-stats {
        gap: 24px;
    }

    .hero-stat .number {
        font-size: 1.4rem;
    }

    .featured-banner {
        grid-template-columns: 1fr;
    }

    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }

    .app-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .app-header .app-badges {
        justify-content: center;
    }

    .app-stats-row {
        flex-wrap: wrap;
    }

    .app-stat {
        min-width: 50%;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .info-row {
        flex-direction: column;
        gap: 4px;
    }

    .info-row .info-label {
        width: auto;
    }

    /* Admin mobile */
    .admin-sidebar {
        display: none;
    }

    .admin-main {
        margin-left: 0;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 40px 0;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .app-card {
        padding: 16px;
    }

    .app-card .app-icon,
    .app-card .app-icon-placeholder {
        width: 52px;
        height: 52px;
        border-radius: 13px;
    }

    .section-header h2 {
        font-size: 1.2rem;
    }

    .screenshot-img {
        height: 240px;
    }
}

/* === Animations === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.5s ease forwards;
}

/* === Loading spinner === */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
