:root {
    --primary-red: #dc3545;
    --bg-gray: #f8f9fa;
    
    /* Capacitor Safe Area Handling */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}


* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

a, button, .card, .menu-icon-box, .nav-item {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-user-select: none;
    user-select: none;
}

.btn:active, .card:active, .nav-item:active {
    transform: scale(0.96);
    opacity: 0.8;
}

body {
    background-color: #f0f0f0; /* Gray background for desktop view */
    margin: 0;
    display: flex;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
}

/* Container Simulator Mobile */
.app-container {
    width: 100%;
    max-width: 480px;
    background: white;
    min-height: 100vh;
    position: relative;
    overflow-x: clip;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

.safe-area-top {
    /* Base safe area + extra 15px for comfort */
    padding-top: calc(15px + var(--safe-area-inset-top)) !important;
}


.content-wrapper {
    flex: 1;
    padding-bottom: calc(100px + var(--safe-area-inset-bottom));
    width: 100%;
    position: relative;
    will-change: transform, opacity;
    animation: snappyIn 0.2s cubic-bezier(0, 0, 0.2, 1);
}

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

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

@keyframes androidOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

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

.page-exit {
    animation: androidOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}

.page-exit-back {
    animation: androidBackOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}

/* Swiper Fixes */
.activitySwiper {
    width: 100%;
    padding-bottom: 50px !important;
    overflow: hidden !important; /* Ubah dari visible ke hidden */
}

/* Header & Banner */
.user-banner {
    background: var(--primary-red);
    border-radius: 15px;
    color: white;
    padding: 20px;
    margin: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.avatar-circle {
    width: 50px;
    height: 50px;
    background: #4a90e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* Menu Grid */
.menu-icon-box {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    font-size: 22px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.menu-icon-box:active {
    transform: scale(0.9);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}
.menu-label {
    font-size: 12px;
    color: #333;
    font-weight: 500;
}

/* Red Section Bottom */
.activity-section {
    background: var(--primary-red);
    border-radius: 35px 35px 0 0;
    padding: 30px 0 20px 0;
    margin-top: 25px;
    flex-grow: 1;
}

/* Search Bar */
.search-wrapper {
    background: white;
    border-radius: 12px;
    margin: 0 20px 25px 20px;
    padding: 5px 15px;
    display: flex;
    align-items: center;
}
.search-wrapper input {
    border: none;
    outline: none;
    width: 100%;
    padding: 8px;
    font-size: 14px;
}

/* Swiper Fixes */
.activitySwiper {
    width: 100%;
    padding-bottom: 50px !important; /* Ruang untuk pagination agar tidak tertutup */
    overflow: visible !important;
}
.swiper-slide {
    height: auto;
    transition: transform 0.3s;
}
.card-event {
    background: white;
    border-radius: 24px;
    border: none;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}
.card-event:active {
    transform: scale(0.97);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}
.card-event .card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.card-event .card-body h6 {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.3;
    height: 2.6em;
    margin-bottom: 12px !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #1a1a1a;
}
.card-event img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}
.card-event:hover img {
    transform: scale(1.05);
}

/* Pagination Dots Custom */
.swiper-pagination {
    bottom: 0px !important;
    z-index: 100;
}
.swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.4) !important;
    opacity: 1;
    transition: all 0.3s ease-in-out;
}
.swiper-pagination-bullet-active {
    background: white !important;
    width: 22px !important;
    border-radius: 10px !important;
}

.badge-custom {
    font-size: 8.5px;
    padding: 1px 6px;
    border-radius: 50px;
    font-weight: 700;
    margin-right: 5px;
    margin-top: 2px;
    display: inline-block;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.b-umum {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    border: 1px solid rgba(13, 110, 253, 0.2);
}
.b-khusus {
    background: rgba(168, 0, 0, 0.1);
    color: var(--primary-red);
    border: 1px solid rgba(168, 0, 0, 0.2);
}
.b-sertifikasi {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
    border: 1px solid rgba(25, 135, 84, 0.2);
}
.b-bimtek {
    background: rgba(102, 16, 242, 0.1);
    color: #6610f2;
    border: 1px solid rgba(102, 16, 242, 0.2);
}
.b-webinar {
    background: rgba(253, 126, 20, 0.1);
    color: #fd7e14;
    border: 1px solid rgba(253, 126, 20, 0.2);
}
.b-diklat {
    background: rgba(214, 51, 132, 0.1);
    color: #d63384;
    border: 1px solid rgba(214, 51, 132, 0.2);
}

/* Tabs Navigation */
.tab-nav {
    display: flex;
    background: white;
    margin: 0 15px;
    border-radius: 12px;
    padding: 5px;
    gap: 5px;
}
.tab-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-radius: 8px;
    transition: 0.3s;
}
.tab-item.active {
    background: var(--primary-red);
    color: white;
}

/* Activity List View */
.activity-list {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.activity-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}
.activity-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
}
.activity-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.activity-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.activity-meta {
    font-size: 11px;
    color: #777;
    margin-bottom: 2px;
}

/* Status Badges */
.status-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    width: fit-content;
    margin-top: 5px;
}
.status-berlangsung { background: #e8f5e9; color: #2e7d32; }
.status-selesai { background: #e3f2fd; color: #1976d2; }
.status-mendatang { background: #fff3e0; color: #ef6c00; }

/* Utilities */
.back-btn {
    font-size: 24px;
    color: var(--primary-red);
    cursor: pointer;
}

/* Remove focus highlight */
input:focus, 
select:focus, 
textarea:focus, 
button:focus {
    outline: none !important;
    box-shadow: none !important;
}

.form-control:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    background-color: white !important;
}

.input-group:focus-within {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important; /* Keep the subtle shadow but no blue border */
    border-color: transparent !important;
}

.input-group-text {
    border: none !important;
}

/* Bottom Navigation */
.nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    padding-bottom: calc(12px + var(--safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(0,0,0,0.05);
    z-index: 2000;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

/* Global Modal Z-Index Overrides to be above nav-bottom */
.modal { z-index: 2050 !important; }
.modal-backdrop { z-index: 2040 !important; }

/* Ensure the container clips correctly */
.app-container {
    overflow-x: clip;
}

.nav-item {
    text-decoration: none;
    color: #888;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    transition: 0.3s;
    width: 20%;
    position: relative;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 2px;
}

.nav-item.active {
    color: var(--primary-red);
}

.nav-item.active i {
    color: var(--primary-red);
}

/* Explore Styles */
.bg-soft-danger { background-color: rgba(168, 0, 0, 0.1); color: var(--primary-red); }
.bg-soft-primary { background-color: rgba(13, 110, 253, 0.1); color: #0d6efd; }
.bg-soft-success { background-color: rgba(25, 135, 84, 0.1); color: #198754; }
.bg-soft-warning { background-color: rgba(255, 193, 7, 0.1); color: #ffc107; }

.category-card {
    border: none;
    border-radius: 16px;
    padding: 15px;
    text-align: center;
    transition: 0.3s;
    height: 100%;
}
.category-card i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}
.category-card span {
    font-size: 13px;
    font-weight: 600;
}

.featured-card {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    color: white;
}
.featured-card img {
    height: 180px;
    width: 100%;
    object-fit: cover;
}
.featured-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

/* Timeline Design */
.timeline {
    position: relative;
    padding-left: 20px;
    margin-left: 10px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: #eee;
}
.timeline-item {
    position: relative;
    padding-bottom: 25px;
    padding-left: 20px;
}
.timeline-dot {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary-red);
    z-index: 1;
}
.timeline-content {
    background: white;
    border-radius: 12px;
    padding: 15px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.timeline-date {
    font-size: 11px;
    font-weight: bold;
    color: var(--primary-red);
    text-transform: uppercase;
    margin-bottom: 5px;
    display: block;
}
.timeline-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 5px;
}
.timeline-info {
    font-size: 0.75rem;
    color: #666;
}
.rolling-scroll {
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.rolling-scroll::-webkit-scrollbar {
    display: none;
}
.rolling-scroll > * {
    flex: 0 0 auto !important;
}

/* Global Page Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(220, 53, 69, 0.1);
    z-index: 9999;
    display: none;
    overflow: hidden;
}
.page-loader .loader-bar {
    width: 40%;
    height: 100%;
    background: var(--primary-red);
    position: absolute;
    animation: loader-progress 1.5s infinite ease-in-out;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
}
@keyframes loader-progress {
    from { left: -40%; }
    to { left: 100%; }
}

/* Skeleton Loading State */
.skeleton {
    background: #eee;
    background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
    border-radius: 5px;
    background-size: 200% 100%;
    animation: 1.5s shine linear infinite;
}
@keyframes shine {
    to {
        background-position-x: -200%;
    }
}

/* Full Page Spinner/Overlay */
.page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.3s ease;
}

.spinner-modern {
    width: 45px;
    height: 45px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    letter-spacing: 0.5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hide when content loaded */
.page-loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
