/**
 * PWA Styles for SiRUP LKPP
 */

/* 1. Navbar / Header Install Button */
.pwa-install-btn {
    display: none; /* revealed via pwa.js when installable */
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #ffe600 0%, #f59e0b 100%);
    color: #854d0e !important;
    font-weight: 700;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    margin: auto 6px;
    text-decoration: none !important;
    line-height: 1.4;
    white-space: nowrap;
}

.pwa-install-btn i {
    font-size: 13px;
    animation: pwaBounce 2s infinite;
}

@keyframes pwaBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-1.5px); }
}

.pwa-install-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    color: #713f12 !important;
}

.pwa-install-btn:active {
    transform: translateY(1px);
}

/* 2. Floating Bottom Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: -150px;
    right: 24px;
    z-index: 99999;
    max-width: 400px;
    width: calc(100% - 48px);
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    pointer-events: none;
}

.pwa-install-banner.pwa-banner-visible {
    bottom: 24px;
    opacity: 1;
    pointer-events: auto;
}

.pwa-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: #da251c;
    box-shadow: 0 4px 10px rgba(218, 37, 28, 0.4);
}

.pwa-banner-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pwa-banner-body {
    flex: 1;
    min-width: 0;
}

.pwa-banner-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 2px 0;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pwa-banner-title .pwa-badge {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 700;
    border: 1px solid rgba(234, 179, 8, 0.4);
}

.pwa-banner-desc {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.35;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-banner-install-btn {
    background: linear-gradient(135deg, #da251c 0%, #b91c1c 100%);
    color: #fff;
    border: none;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(218, 37, 28, 0.3);
    transition: transform 0.2s, background 0.2s;
    white-space: nowrap;
}

.pwa-banner-install-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #e6281e 0%, #c41e1e 100%);
}

.pwa-banner-close-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s, color 0.2s;
}

.pwa-banner-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* 3. iOS Safari Install Modal */
.pwa-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pwa-modal-card {
    background: #fff;
    border-radius: 20px;
    max-width: 440px;
    width: 100%;
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    text-align: center;
    position: relative;
    animation: pwaZoomIn 0.3s ease-out;
}

@keyframes pwaZoomIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.pwa-modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    margin: 0 auto 16px auto;
    box-shadow: 0 4px 14px rgba(218, 37, 28, 0.35);
}

.pwa-modal-title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.pwa-modal-desc {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 20px;
}

.pwa-modal-steps {
    text-align: left;
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 22px;
    border: 1px solid #e2e8f0;
}

.pwa-modal-step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #334155;
}

.pwa-modal-step-item:last-child {
    margin-bottom: 0;
}

.pwa-modal-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #da251c;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-modal-btn-close {
    width: 100%;
    padding: 12px;
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.pwa-modal-btn-close:hover {
    background: #1e293b;
}

/* 4. Toasts */
.pwa-toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 100001;
    background: #1e293b;
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-toast.pwa-toast-show {
    transform: translateY(0);
    opacity: 1;
}

.pwa-toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-toast-success i { color: #10b981; }
.pwa-toast-warning i { color: #f59e0b; }
.pwa-toast-info i { color: #3b82f6; }

.pwa-toast-btn {
    background: #da251c;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.pwa-toast-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}

/* Standalone adjustments */
html.pwa-standalone .pwa-install-btn,
html.pwa-standalone #pwa-install-banner {
    display: none !important;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    body {
        padding-bottom: 78px !important;
    }
    .pwa-install-banner {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: -150px;
    }
    .pwa-install-banner.pwa-banner-visible {
        bottom: 82px !important;
    }
    /* Clean up top navbar on mobile since bottom bar contains all menus */
    .navbar-sirup .navbar-collapse {
        display: none !important;
    }
    .navbar-sirup .navbar-toggle {
        display: none !important;
    }
    .navbar-sirup .navbar-brand {
        font-size: 18px !important;
        padding: 14px 15px !important;
    }
}

/* ==========================================================================
   5. Mobile Bottom Horizontal Scrollable Navigation Bar
   ========================================================================== */
.sirup-mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1045;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
    padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
    .sirup-mobile-bottom-nav {
        display: block !important;
    }
}

.mobile-bottom-nav-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.mobile-bottom-nav-scroll {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding: 2px 12px;
    gap: 6px;
    align-items: center;
}

.mobile-bottom-nav-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 66px;
    padding: 6px 10px;
    border-radius: 12px;
    text-decoration: none !important;
    color: #94a3b8;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    cursor: pointer;
    background: transparent;
    border: none;
    outline: none;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.08);
}

.mobile-nav-item .nav-icon-wrap {
    font-size: 17px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 3px;
    transition: transform 0.2s ease;
}

.mobile-nav-item .nav-label {
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

/* Active State */
.mobile-nav-item.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #da251c 0%, #b91c1c 100%);
    box-shadow: 0 4px 14px rgba(218, 37, 28, 0.45);
}

.mobile-nav-item.active .nav-icon-wrap {
    transform: scale(1.12);
}

.mobile-nav-item.active .nav-label {
    font-weight: 700;
    color: #ffffff;
}

/* Badges on mobile nav */
.mobile-nav-badge {
    position: absolute;
    top: -4px;
    right: -10px;
    background: #ffe600;
    color: #0f172a;
    font-size: 8px;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 6px;
    line-height: 1.1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.mobile-nav-badge-red {
    background: #ef4444;
    color: #ffffff;
}

/* Scroll Fade Indicators */
.mobile-nav-fade-left,
.mobile-nav-fade-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 22px;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 2;
}

.mobile-nav-fade-left {
    left: 0;
    background: linear-gradient(to right, rgba(15, 23, 42, 0.96) 0%, rgba(15, 23, 42, 0) 100%);
    opacity: 0;
}

.mobile-nav-fade-right {
    right: 0;
    background: linear-gradient(to left, rgba(15, 23, 42, 0.96) 0%, rgba(15, 23, 42, 0) 100%);
    opacity: 1;
}

/* Year Selector Modal for Mobile */
#modalMobileTahun .pwa-modal-card {
    text-align: left;
    max-width: 380px;
    padding: 24px;
}

.mobile-year-option-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #1e293b;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.mobile-year-option-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.mobile-year-option-btn.active {
    background: linear-gradient(135deg, #da251c 0%, #b91c1c 100%);
    color: #fff;
    border-color: #b91c1c;
    box-shadow: 0 4px 12px rgba(218, 37, 28, 0.35);
}
