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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #eef2ff;
    --accent: #06b6d4;
    --accent-light: #ecfeff;
    --bg: #f1f5f9;
    --white: #ffffff;
    --text: #0f172a;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--primary); transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

/* ─── Hero ─── */
.hero {
    position: relative;
    text-align: center;
    padding: 80px 20px 60px;
    overflow: hidden;
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 40%, #0ea5e9 100%);
}

.hero-bg {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 80%, rgba(6,182,212,0.25), transparent),
        radial-gradient(ellipse 60% 50% at 80% 20%, rgba(139,92,246,0.3), transparent),
        radial-gradient(ellipse 50% 50% at 50% 50%, rgba(255,255,255,0.05), transparent);
    animation: heroPulse 8s ease-in-out infinite alternate;
}

@keyframes heroPulse {
    0% { opacity: 0.7; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.05); }
}

.hero-content { position: relative; max-width: 680px; margin: 0 auto; }

.hero-actions {
    position: absolute;
    top: 20px; right: 20px;
    display: flex; gap: 8px;
    z-index: 10;
}

.hero-actions a {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.12);
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.3s;
}

.hero-actions a:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
}

.hero h1 {
    color: #fff;
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.15;
    margin-bottom: 16px;
}

.hero-subtitle {
    color: rgba(255,255,255,0.8);
    font-size: 1.1rem;
    line-height: 1.7;
    max-width: 520px;
    margin: 0 auto 32px;
}

.hero-stats {
    display: inline-flex;
    align-items: center;
    gap: 24px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(12px);
    padding: 14px 32px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.15);
}

.hero-stat { text-align: center; }

.hero-stat-number {
    display: block;
    color: #fff;
    font-size: 1.6rem;
    font-weight: 800;
}

.hero-stat-label {
    color: rgba(255,255,255,0.65);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-stat-divider {
    width: 1px;
    height: 36px;
    background: rgba(255,255,255,0.2);
}

/* ─── Tab Nav ─── */
.tab-nav {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}

.tab-nav-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-nav-inner::-webkit-scrollbar { display: none; }

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s;
}

.tab-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.tab-icon { font-size: 0.9rem; }

.tab-count {
    background: rgba(0,0,0,0.08);
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tab-btn.active .tab-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

/* ─── Main Content ─── */
.main-content {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    padding: 0;
    border: 0;
    display: inline;
}

.section-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--white);
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 1.2rem; color: var(--text-light); margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: 0.9rem; }

/* ─── App Grid ─── */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* ─── App Card ─── */
.app-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
}

.app-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.app-card:hover::before { opacity: 1; }

.app-card-top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.app-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-icon { font-size: 1.6rem; }

.app-card .app-image {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
}

.app-card-info {
    flex: 1;
    min-width: 0;
}

.app-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.3;
}

.app-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.category-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    width: fit-content;
}

.badge-alt {
    background: var(--accent-light);
    color: #0891b2;
}

.app-desc {
    color: var(--text-light);
    font-size: 0.87rem;
    line-height: 1.6;
    flex: 1;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.app-more-btn {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 8px;
    background: var(--primary-light);
    transition: all 0.25s;
}

.app-more-btn:hover {
    background: var(--primary);
    color: #fff;
}

.app-coming-soon {
    color: var(--text-muted) !important;
    background: var(--bg) !important;
    cursor: default;
}

.app-coming-soon:hover {
    background: var(--bg) !important;
    color: var(--text-muted) !important;
}

.app-policy-links {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.app-policy-links a {
    font-size: 0.72rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.app-policy-links a:hover { color: var(--primary); }

.app-policy-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
}

/* ─── Store Buttons ─── */
.app-store-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.store-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.25s;
    white-space: nowrap;
}

.store-ios {
    background: #0f172a;
    color: #fff;
}

.store-ios:hover {
    background: #1e293b;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(15,23,42,0.3);
}

.store-android {
    background: #16a34a;
    color: #fff;
}

.store-android:hover {
    background: #15803d;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(22,163,74,0.3);
}

/* ─── Fade animation ─── */
.fade-in {
    animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Footer ─── */
.footer {
    background: #0f172a;
    color: #94a3b8;
    text-align: center;
    padding: 40px 20px;
    margin-top: 0;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #cbd5e1;
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.3s;
}

.footer-links a:hover { color: white; }
.footer p { font-size: 0.82rem; opacity: 0.6; }

/* ─── Legacy header for admin/other pages ─── */
.header {
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 40%, #0ea5e9 100%);
    color: white;
    text-align: center;
    padding: 60px 20px;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
    animation: heroPulse 8s ease-in-out infinite alternate;
}

.header h1 { font-size: 2.8rem; font-weight: 800; margin-bottom: 12px; position: relative; letter-spacing: -0.5px; }
.header p { font-size: 1.15rem; opacity: 0.9; max-width: 600px; margin: 0 auto; position: relative; }

.header-actions {
    position: absolute;
    top: 20px; right: 20px;
    display: flex; gap: 10px;
}

.header-actions a {
    color: white;
    background: rgba(255,255,255,0.12);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.12);
}

.header-actions a:hover { background: rgba(255,255,255,0.25); color: white; }

/* ─── Nav (legacy for non-homepage) ─── */
.nav {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: sticky;
    top: 0; z-index: 100;
    box-shadow: var(--shadow);
}

.nav-inner {
    max-width: 1240px;
    margin: 0 auto;
    display: flex; gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar { display: none; }

.nav-link {
    padding: 14px 20px;
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-light);
}

/* ─── Container ─── */
.container { max-width: 1240px; margin: 0 auto; padding: 30px 20px; }

/* ─── Page Content ─── */
.page-content { max-width: 800px; margin: 0 auto; padding: 40px 20px; }
.page-content h1 { font-size: 2rem; margin-bottom: 8px; }
.page-content .updated { color: var(--text-light); font-size: 0.9rem; margin-bottom: 30px; }
.page-content h2 { font-size: 1.3rem; margin-top: 30px; margin-bottom: 12px; color: var(--primary-dark); }
.page-content p, .page-content ul { color: var(--text-light); margin-bottom: 16px; }
.page-content ul { padding-left: 24px; }
.page-content li { margin-bottom: 8px; }

/* ─── App Policy Header ─── */
.policy-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 6px;
}

.policy-icon img {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.policy-icon span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    font-size: 1.8rem;
    box-shadow: var(--shadow-md);
}

.policy-info { flex: 1; }

.policy-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    line-height: 1.3;
}

.policy-type {
    font-size: 0.88rem;
    color: var(--primary);
    font-weight: 600;
    margin: 2px 0 0;
}

.policy-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.policy-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}

.policy-footer a { color: var(--primary); font-weight: 500; }

.policy-footer-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
}

/* ─── Auth ─── */
.auth-container { max-width: 420px; margin: 60px auto; padding: 0 20px; }

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-card h2 { font-size: 1.5rem; text-align: center; margin-bottom: 8px; }
.auth-card .subtitle { text-align: center; color: var(--text-light); margin-bottom: 30px; font-size: 0.9rem; }

/* ─── Forms ─── */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; color: var(--text); }

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: var(--bg);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.form-group textarea { resize: vertical; min-height: 100px; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    gap: 6px;
}

.btn-primary { background: var(--primary); color: white; width: 100%; padding: 12px; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ─── Alerts ─── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9rem; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ─── Admin ─── */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-header h1 { font-size: 1.5rem; }
.admin-nav { display: flex; gap: 10px; flex-wrap: wrap; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th, .admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.admin-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table tr:hover td { background: #f1f5f9; }
.actions { display: flex; gap: 8px; }

/* ─── Contact ─── */
.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.contact-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.contact-card .contact-icon { font-size: 2rem; margin-bottom: 10px; }
.contact-card h3 { font-size: 1rem; margin-bottom: 6px; }
.contact-card p { color: var(--text-light); font-size: 0.9rem; }

/* ─── Messages ─── */
.messages-list { display: flex; flex-direction: column; gap: 12px; }

.message-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: border-color 0.3s;
}

.message-card:hover { border-color: var(--primary); }

.message-unread {
    border-left: 4px solid var(--primary);
    background: #f8faff;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.message-name { font-size: 0.95rem; }

.message-email {
    font-size: 0.8rem;
    color: var(--primary);
}

.message-source {
    font-size: 0.7rem;
    background: var(--bg);
    color: var(--text-light);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.message-badge-new {
    font-size: 0.7rem;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.message-date {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
}

.message-subject {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.message-body {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 12px;
}

.message-actions {
    display: flex;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .hero { padding: 50px 20px 40px; }
    .hero h1 { font-size: 2.2rem; }
    .hero-subtitle { font-size: 0.95rem; }
    .hero-actions { position: absolute; top: 12px; right: 12px; }
    .hero-stats { padding: 10px 20px; gap: 16px; }
    .hero-stat-number { font-size: 1.3rem; }

    .header { padding: 40px 20px; }
    .header h1 { font-size: 2rem; }
    .header p { font-size: 1rem; }
    .header-actions { position: static; justify-content: center; margin-top: 20px; }

    .app-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

    .auth-card { padding: 24px; }
    .admin-table th, .admin-table td { padding: 8px 10px; }
    .admin-table { font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.8rem; }
    .app-grid { grid-template-columns: 1fr; }
    .tab-nav-inner { padding: 8px 12px; }
}
