/**
 * SLiMS Mobile Features - Stylesheet
 * ====================================
 * Responsive mobile-first CSS untuk semua fitur mobile
 */

/* ==============================================
   ANIMATIONS
   ============================================== */
@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
@keyframes slideDown {
    from { transform: translateX(-50%) translateY(0); opacity: 1; }
    to { transform: translateX(-50%) translateY(100px); opacity: 0; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes slideInUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ==============================================
   MOBILE PANEL
   ============================================== */
#slimsMobileMenuBtn {
    transition: transform 0.2s, box-shadow 0.2s;
}
#slimsMobileMenuBtn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(30, 60, 114, 0.5);
}
#slimsMobileMenuBtn:active {
    transform: scale(0.95);
}

.mobile-panel-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.mobile-panel-content {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    z-index: 10001;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideInUp 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.mobile-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.mobile-panel-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1e3c72;
}

.mobile-panel-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #f0f4ff, #e8eeff);
    border-radius: 12px;
    margin-bottom: 15px;
}
.user-avatar {
    width: 45px; height: 45px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}
.mobile-panel-user strong {
    display: block;
    color: #333;
}
.mobile-panel-user small {
    color: #888;
    font-size: 12px;
}

.mobile-panel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.mobile-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    color: #333;
}
.mobile-menu-item:hover {
    background: #e8eeff;
    border-color: #1e3c72;
    transform: translateY(-2px);
}
.mobile-menu-item:active {
    transform: scale(0.95);
}
.menu-icon {
    font-size: 24px;
}

.mobile-panel-footer {
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid #eee;
    color: #999;
}

/* ==============================================
   MODALS
   ============================================== */
.slims-mobile-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    animation: fadeIn 0.2s ease;
}
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.modal-content {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 24px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideInUp 0.3s ease;
}
.modal-content h3 {
    margin: 0 0 20px;
    color: #1e3c72;
    font-size: 20px;
}

/* ==============================================
   FORMS
   ============================================== */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.form-group input:focus {
    border-color: #1e3c72;
    outline: none;
}

/* ==============================================
   BUTTONS
   ============================================== */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}
.btn-secondary:hover { background: #e9ecef; }

.btn-biometric {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

.btn-share {
    display: inline-block;
    padding: 8px 16px;
    background: #1e3c72;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 8px;
}

/* ==============================================
   BADGES
   ============================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}
.badge-success { background: #27ae60; }
.badge-danger  { background: #e74c3c; }
.badge-warning { background: #f39c12; color: #fff; }
.badge-info    { background: #3498db; }

/* ==============================================
   SCANNER
   ============================================== */
.scanner-modal {
    max-height: 90vh;
}
.scanner-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}
.scanner-tabs .tab {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    transition: all 0.2s;
}
.scanner-tabs .tab.active {
    border-color: #1e3c72;
    background: #e8eeff;
    color: #1e3c72;
}

#scannerViewport {
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}
#scannerViewport video {
    width: 100%;
    border-radius: 12px;
}

.scan-result-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
}
.scan-result-card h4 {
    margin: 0 0 8px;
    color: #1e3c72;
}
.scan-result-card p {
    margin: 4px 0;
    font-size: 13px;
    color: #555;
}

/* ==============================================
   NOTIFICATIONS
   ============================================== */
.notif-list {
    max-height: 60vh;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}
.notif-item.unread {
    background: #f0f4ff;
    border-left: 3px solid #1e3c72;
}
.notif-type {
    font-size: 24px;
    flex-shrink: 0;
}
.notif-body strong {
    display: block;
    font-size: 14px;
    color: #333;
}
.notif-body p {
    margin: 4px 0;
    font-size: 13px;
    color: #666;
}
.notif-body small {
    color: #999;
    font-size: 11px;
}

/* ==============================================
   LOAN HISTORY
   ============================================== */
.loan-list {
    max-height: 60vh;
    overflow-y: auto;
}
.loan-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.loan-item strong {
    display: block;
    font-size: 14px;
    color: #333;
}
.loan-item p {
    margin: 4px 0;
    font-size: 12px;
    color: #666;
}

/* ==============================================
   SHARE DIALOG
   ============================================== */
.slims-mobile-share-dialog .share-dialog-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20000;
}
.share-dialog-content {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 24px;
    z-index: 20001;
    animation: slideInUp 0.3s ease;
}
.share-dialog-content h3 {
    margin: 0 0 16px;
    text-align: center;
    color: #333;
}
.share-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    transition: all 0.2s;
}
.share-btn:hover {
    background: #f0f4ff;
    border-color: #1e3c72;
}
.share-icon { font-size: 24px; }
.share-btn.whatsapp:hover { background: #dcf8c6; border-color: #25d366; }
.share-btn.telegram:hover { background: #e3f2fd; border-color: #0088cc; }
.share-btn.facebook:hover { background: #e8eeff; border-color: #1877f2; }
.share-btn.twitter:hover { background: #e8f5fd; border-color: #1da1f2; }

.share-close-btn {
    width: 100%;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
}

/* ==============================================
   MEMBER CARD
   ============================================== */
.member-card {
    margin: 10px auto;
}

/* ==============================================
   LOADING SPINNER
   ============================================== */
.mobile-spinner {
    width: 40px; height: 40px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #1e3c72;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

/* ==============================================
   TOAST
   ============================================== */
.slims-mobile-toast {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==============================================
   RESPONSIVE
   ============================================== */
@media (min-width: 768px) {
    .mobile-panel-content,
    .modal-content,
    .share-dialog-content {
        max-width: 480px;
        margin: 0 auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .mobile-panel-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 360px) {
    .mobile-panel-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .share-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}
