/* ==================== RESET & VARIABLES ==================== */
:root {
    --bg: #0a0a0f;
    --bg-card: #141420;
    --bg-input: #1a1a2e;
    --primary: #e63946;
    --primary-hover: #ff4757;
    --text: #f1f1f1;
    --text-muted: #8888aa;
    --border: #2a2a3e;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; }

/* ==================== LAYOUT ==================== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ==================== HEADER ==================== */
.site-header {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
    border-bottom: 2px solid var(--primary);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.site-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.site-logo img { height: 40px; width: auto; border-radius: 8px; }
.site-logo h1 { font-size: 1.4rem; font-weight: 700; color: #fff; }
.site-logo h1 span { color: var(--primary); }
.header-nav { display: flex; align-items: center; gap: 16px; }
.header-nav a {
    color: var(--text-muted);
    font-size: .9rem;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all .2s;
}
.header-nav a:hover { color: #fff; background: rgba(230,57,70,0.15); }

/* ==================== HERO ==================== */
.hero { text-align: center; padding: 48px 20px 32px; }
.hero h2 { font-size: 2rem; margin-bottom: 8px; }
.hero p { color: var(--text-muted); font-size: 1.1rem; }

/* ==================== SEARCH & FILTER ==================== */
.search-bar {
    display: flex; gap: 12px; max-width: 600px;
    margin: 24px auto; flex-wrap: wrap; justify-content: center;
}
.search-bar input[type="text"] {
    flex: 1; min-width: 200px; padding: 12px 18px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text);
    font-size: 1rem; outline: none; transition: border-color .2s;
}
.search-bar input:focus { border-color: var(--primary); }
.search-bar button {
    padding: 12px 24px; background: var(--primary); color: #fff;
    border: none; border-radius: var(--radius); cursor: pointer;
    font-size: 1rem; font-weight: 600; transition: background .2s;
}
.search-bar button:hover { background: var(--primary-hover); }

.categories-filter {
    display: flex; gap: 8px; flex-wrap: wrap;
    justify-content: center; margin-bottom: 32px;
}
.cat-btn {
    display: inline-block; padding: 8px 18px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 20px; color: var(--text-muted);
    font-size: .85rem; cursor: pointer; transition: all .2s;
    text-decoration: none;
}
.cat-btn:hover, .cat-btn.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ==================== APPS GRID ==================== */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px; padding-bottom: 48px;
}
.app-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: transform .2s, box-shadow .2s, border-color .2s;
    display: flex; flex-direction: column; text-decoration: none; color: inherit;
}
.app-card:hover {
    transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--primary);
}
.app-card-img {
    width: 100%; aspect-ratio: 1; object-fit: cover; background: #1a1a2e;
}
.app-card-img-placeholder {
    width: 100%; aspect-ratio: 1;
    background: linear-gradient(135deg, #1a1a2e, #2a2a3e);
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: var(--text-muted);
}
.app-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.app-card-body h3 { font-size: 1.1rem; margin-bottom: 4px; color: #fff; }
.app-card-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.app-version {
    font-size: .75rem; padding: 2px 8px;
    background: rgba(230,57,70,0.15); color: var(--primary); border-radius: 6px;
}
.app-category {
    font-size: .75rem; padding: 2px 8px;
    background: rgba(255,255,255,0.05); color: var(--text-muted); border-radius: 6px;
}
.app-card-desc { color: var(--text-muted); font-size: .85rem; margin-bottom: 12px; flex: 1; }
.app-card-footer { display: flex; justify-content: space-between; align-items: center; }
.app-downloads { font-size: .8rem; color: var(--text-muted); }

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; border: none; border-radius: var(--radius);
    cursor: pointer; font-size: .9rem; font-weight: 600;
    transition: all .2s; text-decoration: none; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; }
.btn-block { width: 100%; justify-content: center; }

/* ==================== APP DETAIL ==================== */
.app-detail { max-width: 800px; margin: 32px auto; padding: 0 20px; }
.app-detail-header {
    display: flex; gap: 24px; align-items: flex-start;
    margin-bottom: 24px; flex-wrap: wrap;
}
.app-detail-img {
    width: 180px; height: 180px; border-radius: var(--radius);
    object-fit: cover; flex-shrink: 0; border: 2px solid var(--border);
}
.app-detail-info { flex: 1; min-width: 220px; }
.app-detail-info h1 { font-size: 1.8rem; margin-bottom: 8px; }
.app-detail-info .meta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.app-detail-info .app-desc { color: var(--text-muted); margin-bottom: 16px; }

.download-section {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
}
.download-section h3 {
    margin-bottom: 16px; font-size: 1.2rem;
    display: flex; align-items: center; gap: 8px;
}
.download-methods { display: flex; flex-direction: column; gap: 16px; }
.download-method {
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
}
.download-method h4 { font-size: .95rem; margin-bottom: 8px; color: var(--primary); }
.download-method p { font-size: .85rem; color: var(--text-muted); margin-bottom: 10px; }

.code-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 12px;
}
.code-box code {
    flex: 1; font-family: 'Fira Code', 'Consolas', monospace;
    font-size: .95rem; color: var(--primary); word-break: break-all;
}
.copy-btn {
    padding: 6px 12px; background: var(--primary); color: #fff;
    border: none; border-radius: 6px; cursor: pointer;
    font-size: .8rem; transition: background .2s; white-space: nowrap;
}
.copy-btn:hover { background: var(--primary-hover); }
.copy-btn.copied { background: var(--success); }

.share-buttons { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.share-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; font-size: .85rem;
    font-weight: 600; color: #fff; transition: opacity .2s;
}
.share-btn:hover { opacity: .85; color: #fff; }
.share-whatsapp { background: #25D366; }
.share-telegram { background: #0088cc; }

/* ==================== STATS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px; margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; text-align: center;
}
.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--text-muted); font-size: .85rem; margin-top: 4px; }

/* ==================== TABLES ==================== */
.table-responsive { overflow-x: auto; margin-bottom: 24px; }
.admin-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
}
.admin-table th, .admin-table td {
    padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
.admin-table th {
    background: #0d0d18; color: var(--text-muted);
    font-size: .8rem; text-transform: uppercase; letter-spacing: .5px;
}
.admin-table td { font-size: .9rem; }
.admin-table tr:hover { background: rgba(255,255,255,0.02); }
.admin-table td .actions { display: flex; gap: 6px; }

.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 12px; font-size: .75rem; font-weight: 600;
}
.badge-success { background: rgba(46,204,113,0.15); color: var(--success); }
.badge-danger { background: rgba(231,76,60,0.15); color: var(--danger); }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; margin-bottom: 6px;
    font-size: .85rem; color: var(--text-muted); font-weight: 600;
}
.form-control {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text);
    font-size: .95rem; outline: none; transition: border-color .2s;
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { min-height: 100px; resize: vertical; font-family: inherit; }
select.form-control { appearance: auto; }
input[type="file"].form-control { padding: 8px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ==================== ALERTS ==================== */
.alert {
    padding: 12px 18px; border-radius: 8px;
    margin-bottom: 16px; font-size: .9rem;
}
.alert-success { background: rgba(46,204,113,0.12); color: var(--success); border: 1px solid rgba(46,204,113,0.2); }
.alert-danger { background: rgba(231,76,60,0.12); color: var(--danger); border: 1px solid rgba(231,76,60,0.2); }
.alert-info { background: rgba(52,152,219,0.12); color: #3498db; border: 1px solid rgba(52,152,219,0.2); }

/* ==================== LOGIN ==================== */
.login-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.login-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 40px;
    width: 100%; max-width: 400px;
}
.login-box h1 { text-align: center; margin-bottom: 8px; font-size: 1.5rem; }

/* ==================== FOOTER ==================== */
.site-footer {
    background: #0d0d15; border-top: 1px solid var(--border);
    padding: 24px 0; text-align: center;
    color: var(--text-muted); font-size: .85rem; margin-top: 48px;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .hero h2 { font-size: 1.5rem; }
    .app-detail-header { flex-direction: column; align-items: center; text-align: center; }
    .app-detail-img { width: 140px; height: 140px; }
    .form-row { grid-template-columns: 1fr; }
    .header-inner { flex-wrap: wrap; }
    .header-nav { gap: 8px; }
    .header-nav a { padding: 4px 10px; font-size: .8rem; }
    .apps-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
