/* Mobile-First Patient Interface CSS - SI CANTIK SC */
:root {
    --pink-primary: #ec4899;
    --pink-dark: #db2777;
    --pink-light: #fdf2f8;
    --pink-border: #fbcfe8;
    --header-gradient: linear-gradient(135deg, #f43f5e 0%, #ec4899 50%, #d946ef 100%);
    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
}

body.mobile-body {
    background-color: #f8fafc;
    padding-bottom: 0; /* Space for fixed nav moved inside .mobile-app-wrapper to eliminate grey strip */
    margin: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Mobile Frame Wrapper (centers on desktop like an iPhone frame) */
.mobile-app-wrapper {
    max-width: 480px;
    margin: 0 auto;
    background: #ffffff;
    min-height: 100vh;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.08);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    box-sizing: border-box;
    padding-bottom: 80px; /* Safe space inside wrapper for fixed bottom nav */
}

/* Header App Bar */
.mobile-header {
    background: var(--header-gradient);
    color: #ffffff;
    padding: 1.25rem 1.25rem 1.85rem 1.25rem;
    border-radius: 0 0 1.75rem 1.75rem;
    position: relative;
    box-shadow: 0 8px 24px rgba(236, 72, 153, 0.25);
}

.btn-header-back {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff !important;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s ease;
    backdrop-filter: blur(6px);
}

.btn-header-back:hover,
.btn-header-back:active {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0.96);
}

.backdrop-blur {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Day Stepper Progress (H1 s/d H7) */
.day-stepper-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow-x: auto;
    padding: 0.75rem 0.25rem;
    gap: 0.5rem;
    scrollbar-width: none;
}

.day-stepper-container::-webkit-scrollbar {
    display: none;
}

.day-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
    text-align: center;
    position: relative;
    cursor: pointer;
    text-decoration: none;
}

.day-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    background: #f1f5f9;
    color: #64748b;
    border: 2px solid #e2e8f0;
    transition: all 0.2s ease;
}

.day-step-item.active .day-circle {
    background: #ec4899;
    color: #ffffff;
    border-color: #ec4899;
    box-shadow: 0 0 14px rgba(236, 72, 153, 0.5);
    transform: scale(1.12);
}

.day-step-item.completed .day-circle {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.day-step-item.disabled .day-circle {
    opacity: 0.4;
    cursor: not-allowed;
}

.day-label {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 5px;
    color: #64748b;
}

.day-step-item.active .day-label {
    color: #ec4899;
    font-weight: 700;
}

/* Mobile Cards */
.m-card {
    background: #ffffff;
    border-radius: 1.25rem;
    padding: 1.2rem;
    margin-bottom: 1rem;
    border: 1px solid #edf2f7;
    box-shadow: var(--card-shadow);
}

.m-card-primary {
    background: linear-gradient(135deg, #fdf2f8 0%, #faf5ff 100%);
    border: 1px solid #fbcfe8;
}

.m-card-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fff1f2 100%);
    border: 1px solid #fecdd3;
}

.m-card-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #f0fdfa 100%);
    border: 1px solid #bbf7d0;
}

/* History Entry Card */
.history-entry-card {
    background: #ffffff;
    border-radius: 1.25rem;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid #edf2f7;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.history-entry-card.status-normal {
    border-top: 4px solid #10b981;
}

.history-entry-card.status-danger {
    border-top: 4px solid #ef4444;
}

.history-entry-card.status-pending {
    border-top: 4px solid #f59e0b;
}

/* Nurse Consultation Bubble */
.nurse-consult-bubble {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
}

.nurse-consult-bubble.danger {
    background: #fef2f2;
    border: 1px solid #fecdd3;
}

.nurse-avatar-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #10b981;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    flex-shrink: 0;
}

.nurse-consult-bubble.danger .nurse-avatar-icon {
    background: #ef4444;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* Form Tips & Alerts */
.form-tip-banner {
    background: #fdf2f8;
    border: 1px solid #fbcfe8;
    border-radius: 0.85rem;
    padding: 0.75rem 0.9rem;
    color: #831843;
    font-size: 0.8rem;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* Question Cards */
.question-card {
    background: #ffffff;
    border-radius: 1.25rem;
    padding: 1.25rem;
    margin-bottom: 1.1rem;
    border: 1px solid #edf2f7;
    box-shadow: var(--card-shadow);
}

.question-number-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fdf2f8;
    color: #ec4899;
    border: 1.5px solid #fbcfe8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.question-note-tip {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 0.6rem;
    padding: 0.45rem 0.75rem;
    color: #92400e;
    font-size: 0.76rem;
    line-height: 1.35;
}

/* Custom Interactive Radio Options */
.option-card-radio,
.option-card-checkbox {
    display: block;
    position: relative;
    cursor: pointer;
    margin-bottom: 9px;
    user-select: none;
}

.option-card-radio input[type="radio"],
.option-card-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.option-card-box {
    padding: 12px 16px;
    border-radius: 0.9rem;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.option-card-box:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.option-card-box .check-icon-active {
    display: none;
    font-size: 1.15rem;
}

.option-card-box .check-icon-idle {
    display: inline-block;
    font-size: 1.15rem;
    color: #cbd5e1;
}

.option-card-radio input[type="radio"]:checked + .option-card-box,
.option-card-checkbox input[type="checkbox"]:checked + .option-card-box {
    border-color: #ec4899;
    background: #fdf2f8;
    color: #9d174d;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(236, 72, 153, 0.12);
}

.option-card-radio input[type="radio"]:checked + .option-card-box .check-icon-active,
.option-card-checkbox input[type="checkbox"]:checked + .option-card-box .check-icon-active {
    display: inline-block;
    color: #ec4899;
}

.option-card-radio input[type="radio"]:checked + .option-card-box .check-icon-idle,
.option-card-checkbox input[type="checkbox"]:checked + .option-card-box .check-icon-idle {
    display: none;
}

/* ==========================================================================
   Wong-Baker Visual Facial Pain Rating Scale (Interactive Component)
   ========================================================================== */
.wb-scale-container, .wb-pain-box {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px 6px 12px 6px;
    margin-top: 10px;
    margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
    user-select: none;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
}

.wb-title, .wb-pain-title {
    text-align: center;
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #1e293b;
    margin-bottom: 14px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wb-title::before, .wb-title::after,
.wb-pain-title::before, .wb-pain-title::after {
    content: '';
    height: 1px;
    background: #e2e8f0;
    flex: 1;
}

/* Ruler Track Line & Numbers 0-10 */
.wb-ruler-section, .wb-ruler-wrapper {
    position: relative;
    margin: 0 4px 14px 4px;
    padding: 0;
}

.wb-axis-line, .wb-track-line {
    position: absolute;
    bottom: 7px;
    left: 8px;
    right: 8px;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(to right, 
        #22c55e 0%, 
        #4ade80 20%, 
        #facc15 40%, 
        #fb923c 60%, 
        #ef4444 80%, 
        #991b1b 100%);
    z-index: 1;
}

.wb-num-bar, .wb-number-row {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 2;
    width: 100%;
}

.wb-num-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 18px;
    outline: none;
    flex-shrink: 0;
}

.wb-num-val {
    font-size: 0.7rem;
    font-weight: 800;
    color: #475569;
    margin-bottom: 3px;
    transition: all 0.2s ease;
}

.wb-num-pin {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #94a3b8;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.wb-num-node:hover .wb-num-pin {
    transform: scale(1.18);
    border-color: #ec4899;
}

.wb-num-node.active .wb-num-pin {
    transform: scale(1.3);
    background: var(--node-color, #ec4899);
    border-color: #ffffff;
    box-shadow: 0 0 0 2px var(--node-color, #ec4899), 0 2px 6px rgba(0,0,0,0.25);
}

.wb-num-node.active .wb-num-val {
    color: var(--node-color, #ec4899);
    transform: scale(1.2) translateY(-1px);
    font-weight: 900;
}

/* 6 Faces Grid */
.wb-faces-grid, .wb-faces-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    margin-top: 6px;
    width: 100%;
    box-sizing: border-box;
}

.wb-face-col, .wb-face-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    border-radius: 10px;
    padding: 5px 1px 5px 1px;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
    user-select: none;
    min-width: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
}

.wb-face-col:hover, .wb-face-item:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}

.wb-face-col.active, .wb-face-item.active {
    background: #fdf2f8;
    border-color: #ec4899;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.15);
    transform: scale(1.02);
}

.wb-avatar, .wb-svg-circle {
    width: 100% !important;
    max-width: 38px !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    min-width: 0 !important;
    min-height: 0 !important;
    display: block !important;
    margin: 0 auto;
    border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.1));
}

.wb-face-col.active .wb-avatar,
.wb-face-item.active .wb-svg-circle {
    transform: scale(1.08);
}

.wb-face-lbl, .wb-face-label {
    font-size: 0.56rem;
    font-weight: 700;
    color: #334155;
    margin-top: 3px;
    line-height: 1.15;
    text-align: center;
    width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.wb-face-col.active .wb-face-lbl,
.wb-face-item.active .wb-face-label {
    color: #ec4899;
    font-weight: 800;
}

/* Result Feedback Card */
.wb-feedback-card, .wb-result-badge {
    background: #f0fdf4;
    border-radius: 12px;
    padding: 9px 12px;
    margin-top: 12px;
    border: 1.5px solid #bbf7d0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: all 0.25s ease;
    box-sizing: border-box;
    width: 100%;
}

.wb-feedback-score {
    font-size: 1.15rem;
    font-weight: 900;
    color: #1e293b;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.wb-feedback-title, .wb-result-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
}

.wb-feedback-desc, .wb-result-desc {
    font-size: 0.7rem;
    color: #64748b;
    line-height: 1.25;
    margin-top: 1px;
}

@media (max-width: 480px) {
    .question-card {
        padding: 1rem 0.8rem;
    }
}

@media (max-width: 380px) {
    .question-card {
        padding: 0.9rem 0.65rem !important;
    }
    .wb-scale-container {
        padding: 10px 4px 10px 4px !important;
    }
    .wb-avatar {
        max-width: 33px !important;
    }
    .wb-face-lbl {
        font-size: 0.52rem !important;
    }
    .wb-num-node {
        width: 16px !important;
    }
    .wb-num-pin {
        width: 13px !important;
        height: 13px !important;
    }
    .wb-num-val {
        font-size: 0.65rem !important;
    }
}

/* Photo Upload Box */
.photo-upload-zone {
    padding: 1.5rem 1rem;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.photo-upload-zone:hover {
    border-color: #ec4899;
    background: #fdf2f8;
}

/* Fixed Bottom Navigation Bar */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    justify-content: space-around;
    padding: 0.55rem 0.25rem 0.65rem 0.25rem;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.m-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 62px;
}

.m-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 2px;
    transition: transform 0.2s ease;
}

.m-nav-item:active {
    transform: scale(0.92);
}

.m-nav-item.active {
    color: #ec4899;
}

.m-nav-item.active i {
    transform: translateY(-2px);
}

.m-nav-item.sos-item {
    color: #ef4444;
}

.m-nav-item.sos-item i {
    animation: pulseRed 1.5s infinite;
}

/* Action Buttons */
.btn-mobile-action {
    background: linear-gradient(135deg, #f43f5e 0%, #ec4899 50%, #db2777 100%);
    color: #ffffff;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.95rem 1.5rem;
    border-radius: 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 18px rgba(236, 72, 153, 0.35);
    transition: all 0.2s ease;
}

.btn-mobile-action:hover {
    color: #ffffff;
    box-shadow: 0 6px 22px rgba(236, 72, 153, 0.45);
    transform: translateY(-1px);
}

.btn-mobile-action:active {
    transform: scale(0.98);
}

.btn-emergency-ambulance {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    border: none;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.9rem 1.25rem;
    border-radius: 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
    animation: pulseRed 2s infinite;
}

.btn-emergency-ambulance:hover {
    color: #ffffff;
}

@keyframes pulseRed {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Submit Protection Loading State on Mobile Buttons */
.btn-mobile-action.btn-submitting,
.btn-modern-primary.btn-submitting,
.btn-emergency-ambulance.btn-submitting {
    opacity: 0.85 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn-mobile-action.btn-submitting .spinner-border,
.btn-modern-primary.btn-submitting .spinner-border {
    border-width: 0.15em;
    vertical-align: -0.125em;
}
