/* ==========================================================================
   JDIH Template — Custom Styles
   Modern Government Legal Documentation Website
   ALL @apply directives converted to plain CSS for Tailwind CDN compatibility
   ========================================================================== */

/* ── Base & Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
}

body {
    overflow-x: hidden;
    line-height: 1.7;
}

::selection {
    background-color: #2563eb;
    color: #fff;
}

/* ── Navigation Links ─────────────────────────────────────────────────── */
.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: #4b5563;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
}

.nav-link:hover {
    color: #1e3a5f;
    background-color: #f9fafb;
}

@media (min-width: 1280px) {
    .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

.nav-link.active {
    color: #2563eb;
    background-color: rgba(239, 246, 255, 0.6);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 60%;
}

.dropdown-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #4b5563;
    transition: all 0.15s ease;
    text-decoration: none;
}

.dropdown-link:hover {
    color: #1e3a5f;
    background-color: #f9fafb;
}

/* ── Mobile Nav Links ─────────────────────────────────────────────────── */
.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    border-radius: 0.625rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
    line-height: 1.5;
}

.mobile-nav-link:hover {
    color: #1d4ed8;
    background-color: #eff6ff;
}

.mobile-nav-link.active {
    color: #2563eb;
    background-color: #dbeafe;
    font-weight: 600;
}

/* ── Mobile Drawer ────────────────────────────────────────────────────── */
#mobileMenu {
    /* base transform set inline; CSS transition handles animation */
    will-change: transform;
}

#mobileOverlay {
    will-change: opacity;
}

/* ── Navbar Scroll Effect ─────────────────────────────────────────────── */
.navbar-scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.95) !important;
}

/* ── Produk Hukum Cards ───────────────────────────────────────────────── */
.produk-card {
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    padding: 1rem 1.25rem;
    transition: border-color 0.2s ease;
}

.produk-card:hover {
    border-color: #d1d5db;
}

#navbar {
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

/* ── Feature Cards ────────────────────────────────────────────────────── */
.feature-card {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.feature-card:hover {
    border-color: #d1d5db;
}

.feature-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

/* ── Link Related Cards ────────────────────────────────────────────── */
.link-terkait-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    padding: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.link-terkait-card:hover {
    border-color: #d1d5db;
}

.feature-card:hover {
    border-color: #e2e8f0;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    transform: translateY(-4px);
}

.feature-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* ── Feature icon hover scale effect ─────────────────────────────── */
.feature-card:hover .feature-icon {
    transform: scale(1.1);
}

/* ── Produk Hukum Cards ───────────────────────────────────────────────── */
.produk-card {
    background: #fff;
    border-radius: 0.875rem;
    border: 1px solid #f1f5f9;
    padding: 1rem 1.25rem;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.produk-card:hover {
    border-color: #bfdbfe;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
}

/* ── Filter Select ────────────────────────────────────────────────────── */
.filter-select {
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
}

.filter-select:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 500;
}

.badge-blue    { background: #eff6ff; color: #1d4ed8; }
.badge-emerald { background: #ecfdf5; color: #047857; }
.badge-amber   { background: #fffbeb; color: #b45309; }
.badge-green   { background: #f0fdf4; color: #15803d; }
.badge-red     { background: #fef2f2; color: #dc2626; }
.badge-yellow  { background: #fefce8; color: #a16207; }
.badge-purple  { background: #faf5ff; color: #7e22ce; }
.badge-rose    { background: #fff1f2; color: #be123c; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #2563eb;
    color: #fff;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background 0.15s ease;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
    text-decoration: none;
    cursor: pointer;
}

.btn-outline:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #2563eb;
}

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    background: #fff;
    border: 1px solid #e5e7eb;
    transition: all 0.15s ease;
    cursor: pointer;
}

.pagination-btn:hover {
    border-color: #93c5fd;
    color: #2563eb;
    background: #eff6ff;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.pagination-btn.active:hover {
    background: #1d4ed8;
    color: #fff;
}

/* ── Statistic Cards ──────────────────────────────────────────────────── */
.stat-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ── News Cards ───────────────────────────────────────────────────────── */
.news-card {
    background: #fff;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

.news-card:hover {
    border-color: #bfdbfe;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.10);
}

.news-card-sm {
    background: #fff;
    border-radius: 0.875rem;
    overflow: hidden;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

.news-card-sm:hover {
    border-color: #bfdbfe;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.10);
    transform: translateY(-2px);
}

/* ── Book Cards ───────────────────────────────────────────────────────── */
.book-card {
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: border-color 0.2s ease;
}

.book-card:hover {
    border-color: #d1d5db;
}

/* ── Tab Buttons ──────────────────────────────────────────────────────── */
.tab-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    background: #f3f4f6;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.tab-btn:hover {
    background: #e5e7eb;
}

.tab-btn.active {
    background: #2563eb;
    color: #fff;
}

.tab-btn.active:hover {
    background: #1d4ed8;
}

/* ── Search Tabs ──────────────────────────────────────────────────────── */
.search-tab {
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    border: none;
}

.search-tab.active {
    background: #2563eb;
    color: #fff;
}

.search-tab:hover:not(.active) {
    background: #e5e7eb;
}

/* ── Link Terkait Cards ───────────────────────────────────────────────── */
.link-terkait-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border-radius: 1rem;
    border: 1px solid #f3f4f6;
    padding: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.link-terkait-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    transform: translateY(-4px);
}

/* ── Galeri Slider ────────────────────────────────────────────────────── */
.galeri-dot.active {
    background-color: #2563eb;
}

.galeri-dot:not(.active) {
    background-color: #d1d5db;
}

.galeri-dot:not(.active):hover {
    background-color: #9ca3af;
}

/* ── Line Clamp Utilities ─────────────────────────────────────────────── */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Counter Animation ────────────────────────────────────────────────── */
.counter {
    font-variant-numeric: tabular-nums;
}

/* ── Progress Bar Animation ───────────────────────────────────────────── */
@keyframes progressFill {
    from { width: 0; }
}

.progress-animate {
    animation: progressFill 1.5s ease-out forwards;
}

/* ── Satisfaction Ring Animation ──────────────────────────────────────── */
@keyframes satisfactionRing {
    from { stroke-dashoffset: 440; }
}

.satisfaction-ring {
    animation: satisfactionRing 1.8s ease-out forwards;
}

/* ── Back to Top Button ───────────────────────────────────────────────── */
#backToTop.visible {
    opacity: 1;
    visibility: visible;
}

/* ── Smooth Scroll Offset (for sticky header) ─────────────────────────── */
[id] {
    scroll-margin-top: 80px;
}

/* ── Custom Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ── Print Styles ─────────────────────────────────────────────────────── */
@media print {
    header, footer, #backToTop, .tab-btn, .pagination-btn {
        display: none !important;
    }
    body {
        font-size: 12pt;
        color: #000;
    }
    section {
        page-break-inside: avoid;
    }
}

/* ── Responsive Adjustments ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .stat-card p.font-heading {
        font-size: 1.25rem;
    }
}

/* ── Accessibility: Focus Ring ────────────────────────────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Skip to Content (screen readers) ─────────────────────────────────── */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: fixed;
    top: 8px;
    left: 8px;
    width: auto;
    height: auto;
    padding: 12px 24px;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    z-index: 99999;
}

/* ── Modern Dropdown ──────────────────────────────────────────────────── */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    min-width: 200px;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    padding: 0.5rem;
    z-index: 50;
}

.group:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ── Mobile Menu Animation ─────────────────────────────────────────── */
#mobileMenu {
    transition: max-height 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

#mobileMenu:not(.hidden) {
    max-height: 80vh;
}

#mobileMenu.hidden {
    display: block;
    max-height: 0;
}

/* ── Link Hover Animation ───────────────────────────────────────────── */
a.animated-link {
    position: relative;
}

a.animated-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.25s ease;
}

a.animated-link:hover::after {
    width: 100%;
}

#mobileMenu:not(.hidden) {
    max-height: 80vh;
}

#mobileMenu.hidden {
    display: block;
    max-height: 0;
    opacity: 0;
}

/* ── Modern Animated Gradient Background ──────────────────────────────── */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.animated-gradient {
    background-size: 200% 200%;
    animation: gradientShift 12s ease infinite;
}

/* ── Aurora Blob Animation ────────────────────────────────────────────── */
@keyframes floatBlob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(25px, -20px) scale(1.05); }
    66% { transform: translate(-15px, 15px) scale(0.95); }
}

.aurora-blob {
    animation: floatBlob 10s ease-in-out infinite;
}

.aurora-blob-delay {
    animation: floatBlob 12s ease-in-out 3s infinite;
}

/* ── Link Hover Animation ───────────────────────────────────────────── */
a.animated-link {
    position: relative;
}

a.animated-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.25s ease;
}

a.animated-link:hover::after {
    width: 100%;
}

/* ── Modern Section Divider ───────────────────────────────────────────── */
.section-divider {
    background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
    height: 1px;
    border: none;
}

/* ── Glow Effect on Hover ─────────────────────────────────────────────── */
.glow-hover {
    transition: box-shadow 0.3s ease;
}

.glow-hover:hover {
    box-shadow: 0 0 30px rgba(37, 99, 235, 0.15),
                0 8px 24px rgba(0, 0, 0, 0.06);
}

/* ── Modern Text Gradient ─────────────────────────────────────────────── */
.text-gradient {
    background: linear-gradient(135deg, #2563eb, #1e3a5f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Smooth Image Zoom ────────────────────────────────────────────────── */
.img-zoom {
    overflow: hidden;
}

.img-zoom img,
.img-zoom > div:first-child {
    transition: transform 0.5s ease;
}

.img-zoom:hover img,
.img-zoom:hover > div:first-child {
    transform: scale(1.06);
}

/* ── Modern Tag / Chip ────────────────────────────────────────────────── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #4b5563;
    transition: all 0.15s ease;
}

.chip:hover {
    background: #e5e7eb;
}

/* ── Skeleton Loading Placeholder ─────────────────────────────────────── */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

/* ── Subtle Entrance Animation ────────────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

/* ── Topbar Marquee Animation ────────────────────────────────────────── */
.marquee-wrap {
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

.marquee-text {
    display: inline-block;
    animation: marqueeScroll 35s linear 2s infinite;
    font-weight: 500;
    will-change: transform;
}

@keyframes marqueeScroll {
    0%   { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}
