* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #151937;
    --bg-card: rgba(21, 25, 55, 0.8);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent-primary: #06b6d4;
    --accent-secondary: #0891b2;
    --accent-tertiary: #0e7490;
    --border-color: rgba(6, 182, 212, 0.2);
    --shadow-color: rgba(6, 182, 212, 0.3);
}

[data-theme="light"] {
    --bg-primary: #f0f9ff;
    --bg-secondary: #e0f2fe;
    --bg-card: rgba(255, 255, 255, 0.9);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --accent-primary: #06b6d4;
    --accent-secondary: #0891b2;
    --accent-tertiary: #0e7490;
    --border-color: rgba(6, 182, 212, 0.3);
    --shadow-color: rgba(6, 182, 212, 0.2);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    color: var(--text-secondary);
    position: relative;
    overflow-x: hidden;
    transition: background 0.3s ease;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
    animation: rotate 30s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 12px 24px;
    cursor: pointer;
    box-shadow: 0 8px 32px var(--shadow-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 48px var(--shadow-color);
}

.theme-icon {
    font-size: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 2;
}

.header {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--border-color);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    margin-bottom: 30px;
}

.government-logo {
    width: 90px;
    height: 90px;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-shadow: 0 8px 32px var(--shadow-color);
    position: relative;
    animation: float 3s ease-in-out infinite;
}

.government-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.header-title {
    flex: 1;
    text-align: left;
}

/* ID ditambahkan untuk diisi JS */
.header h1#portalAppName {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -0.03em;
}

.header .subtitle {
    font-size: 1.2rem;
    color: var(--accent-secondary);
    font-weight: 600;
    margin-bottom: 15px;
}

.header .description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.search-container {
    max-width: 700px;
    margin: 0 auto 40px;
}

.search-wrapper {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--border-color);
    transition: all 0.3s ease;
}

.search-wrapper:focus-within {
    box-shadow: 0 12px 48px var(--shadow-color), 0 0 0 2px var(--accent-primary);
    transform: translateY(-2px);
}

.search-box {
    width: 100%;
    padding: 20px 60px 20px 24px;
    border: none;
    border-radius: 20px;
    font-size: 1.05rem;
    background: transparent;
    outline: none;
    color: var(--text-primary);
}

.search-box::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    color: var(--accent-primary);
}

/* Loader ditambahkan */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
    grid-column: 1 / -1; /* Span full width in grid */
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 28px;
}

/* GAYA BARU: Header Kategori */
.category-header {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    grid-column: 1 / -1; /* Membuat header span full width */
    display: block; /* Pastikan ini block */
    transition: all 0.3s ease;
}

.app-card {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border-radius: 24px;
    padding: 35px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--border-color);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s ease;
}

.app-card:hover::before {
    transform: scaleX(1);
}

.app-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.15), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.app-card:hover::after {
    width: 500px;
    height: 500px;
}

.app-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 24px 80px var(--shadow-color);
}

.app-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.app-icon {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-shadow: 0 8px 24px var(--shadow-color);
    transition: all 0.3s;
    border: 2px solid rgba(6, 182, 212, 0.2);
}

.app-icon img {
    width: 130%;
    height: 130%;
    object-fit: contain;
}

.app-card:hover .app-icon {
    transform: rotate(5deg) scale(1.1);
}

.app-info {
    flex: 1;
}

.app-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.app-category {
    font-size: 0.85rem;
    color: var(--accent-secondary);
    font-weight: 600;
    background: rgba(6, 182, 212, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-block;
    border: 1px solid var(--border-color);
}

.app-status {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-block;
    margin-left: 10px;
}

.app-status.aktif {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.app-status.tidak-aktif {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.app-description {
    font-size: 0.98rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.app-url {
    font-size: 0.88rem;
    color: var(--accent-secondary);
    font-weight: 600;
    background: rgba(6, 182, 212, 0.1);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    /* URL diperpanjang */
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 16px var(--shadow-color);
}

/* Status badge dihapus karena sudah dipindah ke samping kategori */
.status-badge::before {
    content: '●';
    animation: pulse 2s infinite;
}

.footer {
    margin-top: 60px;
    text-align: center;
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--border-color);
}

.footer h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* ID ditambahkan untuk diisi JS */
.footer p#portalFooterText {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .container {
        padding: 80px 15px 20px;
    }
    
    .header {
        padding: 30px;
    }
    
    .logo-section {
        flex-direction: column;
    }
    
    .header-title {
        text-align: center;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        padding: 10px 16px;
    }
    
    .category-header {
        font-size: 1.4rem;
    }
}

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hidden {
    display: none;
}

.no-results {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-top: 40px;
    display: none;
    padding: 40px;
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border-radius: 24px;
    grid-column: 1 / -1; /* Span full width */
}