/* --- VARIABLES --- */
:root {
    --primary-green: #2E7D32; 
    --secondary-green: #4CAF50;
    --accent-color: #EF6C00;
    --text-dark: #1a202c;
    --text-light: #5a6a85;
    
    /* Premium Glass */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: 1px solid rgba(255, 255, 255, 0.8);
    --shadow-soft: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-hover: 0 15px 40px rgba(46, 125, 50, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    height: 100vh;
    font-family: 'Poppins', sans-serif;
    color: var(--text-dark);
    display: flex; justify-content: center; align-items: center;
    overflow: hidden; 
    position: relative;
    background-color: #f0f2f5; 
}

/* --- BACKGROUND --- */
body::before {
    content: "";
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background-image: url('../images/background-rsud.png');
    background-repeat: no-repeat;
    filter: brightness(0.92);
    background-size: 100% 100%; 
    background-position: center;
}

/* --- TRIGGER AREA --- */
.logo-trigger-container {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex; flex-direction: column; align-items: center;
    transition: all 0.5s ease;
}
.logo-trigger-container.hidden {
    opacity: 0; visibility: hidden; transform: translate(-50%, -50%) scale(0.8);
}
#logo-hotspot {
    width: 350px; height: 300px;
    cursor: pointer; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); z-index: 2;
}

/* Pulse Effect */
.pulse-ring {
    width: 100px; height: 100px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    animation: pulse 2s infinite; pointer-events: none;
}
@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { opacity: 0.6; }
    100% { transform: scale(2.2); opacity: 0; }
}

.mobile-tap-indicator {
    display: none; flex-direction: column; align-items: center;
    color: #fff; z-index: 5; pointer-events: none;
    text-shadow: 0 2px 5px rgba(0,0,0,0.6);
}
.tap-icon { font-size: 32px; margin-bottom: 8px; animation: bounce 2s infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* --- PORTAL MAIN MENU (DESKTOP) --- */
.portal-container {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%; max-width: 1100px;
    z-index: 20;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.portal-container.visible {
    opacity: 1; visibility: visible; pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.logo-header-text { text-align: center; margin-bottom: 30px; color: #fff; }
.logo-header-text h2 { font-size: 36px; font-weight: 700; text-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.logo-header-text p { font-size: 18px; font-weight: 300; letter-spacing: 1px; }

.portal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 25px; }

/* Desktop Card */
.menu-card {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 24px;
    padding: 30px 20px;
    text-align: center; text-decoration: none;
    color: var(--text-dark);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: all 0.3s ease;
    height: 100%; min-height: 220px;
    position: relative;
    box-shadow: var(--shadow-soft);
}
.menu-card:hover {
    transform: translateY(-8px);
    background: #fff;
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-green);
}

.card-icon {
    font-size: 52px; margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: transform 0.3s;
}
.menu-card:hover .card-icon { transform: scale(1.1) rotate(-5deg); }

.menu-card h4 { font-size: 19px; margin-bottom: 6px; font-weight: 700; color: #333; }
.menu-card p { font-size: 13px; color: var(--text-light); }
.card-arrow { display: none; }

.portal-close-btn {
    position: absolute; top: -60px; right: 0;
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.25); border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    color: #fff; cursor: pointer; transition: 0.3s; font-size: 22px;
    backdrop-filter: blur(5px); border: 1px solid rgba(255,255,255,0.3);
}
.portal-close-btn:hover { background: #fff; color: var(--primary-green); transform: rotate(90deg); }

.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(8px);
    z-index: 15; opacity: 0; visibility: hidden; transition: 0.4s;
}
.overlay.visible { opacity: 1; visibility: visible; }

.footer-copyright {
    position: fixed; bottom: 15px; width: 100%; text-align: center;
    color: rgba(255,255,255,0.85); font-size: 12px; z-index: 5; pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Info Box */
.info-container { position: fixed; top: 30px; right: 30px; z-index: 100; }
.info-trigger {
    width: 45px; height: 45px; background: #fff; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    color: var(--primary-green); cursor: pointer; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.15); transition: 0.3s;
}
.info-trigger:hover { transform: scale(1.1); color: var(--accent-color); }
.info-box {
    position: absolute; top: 60px; right: 0; width: 340px;
    background: #fff; border-radius: 16px; padding: 25px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    opacity: 0; visibility: hidden; transform: translateX(20px); transition: 0.3s;
    /* Tambahan agar scrollable jika konten panjang */
    max-height: 80vh; overflow-y: auto;
}
.info-box.active { opacity: 1; visibility: visible; transform: translateX(0); }
.info-box h3 { font-size: 15px; color: var(--primary-green); margin: 15px 0 8px; border-bottom: 1px solid #f0f0f0; padding-bottom: 5px; }
.info-box h3:first-child { margin-top: 0; }
.info-box p, .info-box ul { font-size: 13px; color: var(--text-light); line-height: 1.6; }
.info-box ul { padding-left: 18px; margin-bottom: 10px; }

/* --- SUBMENU (DESKTOP) --- */
.submenu-container {
    position: absolute; top: 50%; left: 50%; 
    transform: translate(-50%, -50%) scale(0.95);
    width: 650px; background: #fff; padding: 35px; border-radius: 24px;
    z-index: 25; 
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}
.submenu-container.visible { 
    opacity: 1; visibility: visible; pointer-events: auto;
    transform: translate(-50%, -50%) scale(1); 
}

.submenu-header { display: flex; align-items: center; margin-bottom: 25px; border-bottom: 2px solid #f5f5f5; padding-bottom: 15px; }
.submenu-header i { font-size: 32px; color: var(--primary-green); margin-right: 18px; }
.submenu-header h2 { font-size: 26px; font-weight: 700; color: #2d3748; }

.submenu-item {
    display: flex; align-items: center; padding: 18px; background: #fff;
    border-radius: 16px; margin-bottom: 12px; text-decoration: none; color: var(--text-dark);
    transition: 0.2s; border: 1px solid #eee;
}
.submenu-item:hover { 
    border-color: var(--primary-green); background: #f8fff9; 
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(46, 125, 50, 0.1); 
}
.submenu-item .icon-wrapper {
    width: 50px; height: 50px; background: rgba(46, 125, 50, 0.08); border-radius: 12px;
    display: flex; justify-content: center; align-items: center; margin-right: 20px; color: var(--primary-green); flex-shrink: 0;
}
.submenu-item .icon-wrapper i { font-size: 24px; }
.submenu-item strong { display: block; font-size: 16px; margin-bottom: 3px; color: #333; }
.submenu-item span { font-size: 13px; color: #666; }

.back-button { 
    display: inline-flex; align-items: center; margin-top: 25px; 
    color: #888; text-decoration: none; font-size: 14px; font-weight: 500; transition: 0.2s;
}
.back-button:hover { color: var(--primary-green); transform: translateX(-3px); }


/* ==========================================================================
   --- RESPONSIVE DESIGN (TABLET & MOBILE) ---
   ========================================================================== */

/* 1. TABLET (iPad/Tab) */
@media (min-width: 768px) and (max-width: 1024px) {
    body::before { background-size: cover; background-position: center; }
    #logo-hotspot { width: 100%; height: 100%; } 
    .mobile-tap-indicator { display: flex; }

    .portal-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 20px; 
        padding: 0 20px;
    }
    
    .portal-container { 
        width: 80%; max-width: 700px;
        position: fixed; bottom: 0; top: auto; left: 0;
        transform: translateY(100%);
        border-radius: 30px 30px 0 0;
        background: rgba(255, 255, 255, 0.96); 
        backdrop-filter: blur(10px);
        padding-bottom: 40px;
    }
    .portal-container.visible { transform: translateY(0); }
    
    .logo-header-text h2 { color: #333; text-shadow: none; font-size: 28px; }
    .logo-header-text p { color: #666; }
    
    .menu-card {
        min-height: 180px;
        background: linear-gradient(135deg, #ffffff, #f1f8e9);
        border: 1px solid #c8e6c9;
    }
    .card-icon { font-size: 42px; }
    
    .mobile-drag-handle {
        width: 60px; height: 6px; background: #e0e0e0; border-radius: 10px;
        margin: 0 auto 25px auto;
    }
    .portal-close-btn { top: 20px; right: 20px; background: #eee; color: #333; }
}

/* 2. MOBILE (Smartphone) - Max 767px */
@media (max-width: 767px) {
    body::before { background-size: cover; background-position: center top; }
    #logo-hotspot { width: 100%; height: 100%; } 
    .mobile-tap-indicator { display: flex; }
    .pulse-ring { width: 80px; height: 80px; }

    /* --- BOTTOM SHEET MENU (PERCANTIK) --- */
    .portal-container {
        position: fixed; bottom: 0; left: 0; top: auto; 
        width: 100%; max-width: 100%;
        transform: translateY(110%);
        border-radius: 28px 28px 0 0; 
        
        background: rgba(255, 255, 255, 0.96); 
        backdrop-filter: blur(12px);
        
        padding: 20px 20px 40px 20px;
        display: flex; flex-direction: column;
        max-height: 85vh; overflow-y: auto;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    }
    .portal-container.visible {
        transform: translateY(0); 
        animation: slideUp 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    }
    @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

    .mobile-drag-handle {
        width: 45px; height: 5px; background: #cbd5e0; border-radius: 10px;
        align-self: center; margin-bottom: 25px;
    }

    .logo-header-text { margin-bottom: 20px; text-align: left; padding-left: 5px; }
    .logo-header-text h2 { color: #1a202c; font-size: 22px; text-shadow: none; margin-bottom: 4px; }
    .logo-header-text p { color: #718096; font-size: 13px; }

    .portal-grid { grid-template-columns: 1fr; gap: 14px; }

    /* --- MOBILE CARD STYLE (PERCANTIK) --- */
    .menu-card {
        flex-direction: row; justify-content: space-between; align-items: center;
        padding: 18px; min-height: auto;
        
        /* WARNA BACKGROUND & GRADASI HALUS */
        background: linear-gradient(145deg, #ffffff, #f1f8e9); 
        
        /* AKSEN BORDER KIRI */
        border: 1px solid #e0f2f1; 
        border-left: 5px solid var(--primary-green);
        
        box-shadow: 0 4px 10px rgba(0,0,0,0.03);
        border-radius: 12px;
        
        opacity: 0; animation: itemSlideIn 0.5s forwards;
        animation-delay: calc(0.1s * var(--i));
    }
    @keyframes itemSlideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

    .menu-card:active { 
        background: #e8f5e9; 
        transform: scale(0.98); 
    }
    
    .card-icon {
        font-size: 22px; margin-bottom: 0; margin-right: 18px;
        width: 50px; height: 50px; display: flex; justify-content: center; align-items: center;
        
        /* Icon Background lebih tegas */
        background: rgba(46, 125, 50, 0.12); 
        border-radius: 12px;
        
        /* RESET GRADIENT AGAR ICON MUNCUL SOLID */
        -webkit-background-clip: border-box;
        background-clip: border-box;
        -webkit-text-fill-color: var(--primary-green);
        color: var(--primary-green);
    }
    .card-content { flex: 1; text-align: left; }
    .menu-card h4 { font-size: 15px; margin-bottom: 3px; color: #2d3748; }
    .menu-card p { font-size: 11px; color: #718096; }
    .card-arrow { display: block; color: var(--primary-green); font-size: 14px; opacity: 0.7; }

    .portal-close-btn {
        top: 20px; right: 20px; background: #edf2f7; color: #4a5568;
        width: 36px; height: 36px; font-size: 16px; border: none;
    }

    /* Submenu Mobile */
    .submenu-container {
        width: 100%; height: 100%; max-height: 100%; border-radius: 0;
        top: 0; left: 0; bottom: 0; right: 0;
        transform: translateX(100%); 
        padding: 25px 20px; 
        overflow-y: auto; background: #fff;
        z-index: 30; 
    }
    .submenu-container.visible { transform: translateX(0); }
    
    .submenu-header { margin-top: 10px; border-bottom: none; }
    .submenu-item { padding: 16px; border: 1px solid #f0f0f0; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }

    .info-container { top: 15px; right: 15px; }
    .info-box {
        position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.95);
        width: 85%; max-width: 350px; right: auto; border-top: 4px solid var(--primary-green);
        /* Scrollable */
        max-height: 70vh; overflow-y: auto;
    }
    .info-box.active { transform: translate(-50%, -50%) scale(1); }
}