/* ============================================================
   MOBILE SUPREME DESIGN SYSTEM v2.0
   Extracted from beranda_app.php & login.php
   Contains generic premium app-like mobile styling and dark mode.
   ============================================================ */

/* 1. ANIMATIONS */
@keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes iconBounce {
    0% { opacity: 0; transform: scale(0.6); }
    60% { opacity: 1; transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes pulse-continuous {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}
@keyframes ripple-animation {
    to { transform: scale(1); opacity: 0; }
}

/* 2. BASE APP COMPONENTS (Prefix: app-) */
.app-card {
    border-radius: 16px;
    background: var(--bg-elevated, #ffffff);
    border: 1px solid var(--border-hairline, #e2e8f0);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    padding: 14px 16px;
    transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.app-card.clickable:active,
a.app-card:active,
button.app-card:active {
    transform: scale(0.97);
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.app-card-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.app-grid-4col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.app-grid-item {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 12px;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}
.app-grid-item:active {
    transform: scale(0.92);
}

/* Table replacements (Row cards) */
.app-row-card {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: var(--bg-elevated, #ffffff);
    border: 1px solid var(--border-hairline, #e2e8f0);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    padding: 14px 16px;
    margin-bottom: 12px;
    position: relative;
    transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.15s;
}
.app-row-card:active {
    transform: scale(0.97);
}

.app-badge-pill {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* 3. RESPONSIVE / MOBILE OVERRIDES */
@media (max-width: 768px) {
    .table-responsive.app-mobile-cards table,
    .table-responsive.app-mobile-cards thead,
    .table-responsive.app-mobile-cards tbody,
    .table-responsive.app-mobile-cards th,
    .table-responsive.app-mobile-cards td,
    .table-responsive.app-mobile-cards tr {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .table-responsive.app-mobile-cards {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        background: transparent !important;
    }

    .table-responsive.app-mobile-cards thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-responsive.app-mobile-cards tr { 
        border-radius: 16px;
        background: var(--bg-elevated, #ffffff);
        border: 1px solid var(--border-hairline, #e2e8f0);
        box-shadow: 0 4px 15px rgba(0,0,0,0.02);
        padding: 14px 16px;
        margin-bottom: 12px;
        position: relative;
    }

    /* P6: Page headers */
    h1, .h1, .page-title { font-size: 1.35rem !important; }
    h2, .h2 { font-size: 1.15rem !important; }

    /* P: Input / select full width in forms */
    .form-control, .form-select, select.select-modern {
        font-size: 16px !important; /* iOS no-zoom */
        width: 100% !important;
    }

    /* P: Modal/Swal full-width on mobile */
    .modal-dialog { margin: 8px !important; max-width: calc(100vw - 16px) !important; }
    .modal-content { border-radius: 16px !important; }
    .swal2-popup { width: 90vw !important; max-width: 360px !important; }
}

/* 4. RIPPLE */
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(59, 79, 217, 0.15);
    transform: scale(0);
    animation: ripple-animation 0.5s linear;
    pointer-events: none;
}
body.dark-mode .ripple-effect {
    background: rgba(255, 255, 255, 0.15);
}

/* 5. DARK MODE OVERRIDES */
body.dark-mode {
    --bg-elevated: rgba(18,27,46,0.75);
    --border-hairline: rgba(255,255,255,0.08);
}
body.dark-mode .app-card,
body.dark-mode .app-row-card,
body.dark-mode .table-responsive.app-mobile-cards tr {
    background: var(--bg-elevated) !important;
    border-color: var(--border-hairline) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15) !important;
    color: var(--text-primary) !important;
}
