/* Mobile-First UI Custom Enhancements */

/* Safe Area Insets for Modern Mobile Phones (iPhone Notch / Dynamic Island) */
.pt-safe {
    padding-top: env(safe-area-inset-top, 0px);
}
.pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 12px);
}

/* Touch & Interaction Optimizations */
html, body {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* Radio Card Peer Checking */
.radio-card input:checked ~ div:first-of-type,
.activity-card input:checked ~ div:first-of-type > div:first-child {
    background-color: #4f46e5 !important;
    color: #ffffff !important;
}

.radio-card input:checked ~ .custom-radio,
.activity-card input:checked ~ div:first-of-type > .custom-radio {
    border-color: #6366f1 !important;
    background-color: #4f46e5 !important;
}

.radio-card input:checked ~ .custom-radio i,
.activity-card input:checked ~ div:first-of-type > .custom-radio i {
    opacity: 1 !important;
}

.radio-card:has(input:checked),
.activity-card:has(input:checked) {
    border-color: #6366f1 !important;
    background-color: rgba(30, 27, 75, 0.5) !important;
    box-shadow: 0 0 24px rgba(99, 102, 241, 0.25);
}

/* ========================================================= */
/* Creative Grade Selection Animations & Uniform Styles      */
/* ========================================================= */

.grade-chip {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    z-index: 1;
}

.grade-chip * {
    pointer-events: none;
}

.grade-chip:hover {
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.grade-chip.active {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #7c3aed 100%) !important;
    border-color: #818cf8 !important;
    color: #ffffff !important;
    box-shadow: 0 8px 25px -4px rgba(99, 102, 241, 0.5), 0 0 15px rgba(124, 58, 237, 0.3);
    animation: springBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.grade-chip.active span:first-child {
    color: #ffffff !important;
}

.grade-chip.active span.w-2 {
    background-color: #ffffff !important;
    box-shadow: 0 0 8px #ffffff;
}

@keyframes springBounce {
    0% { transform: scale(0.92); }
    50% { transform: scale(1.06); }
    75% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

/* Form Card Glow */
.form-card {
    transition: all 0.25s ease-out;
}
.form-card:focus-within {
    border-color: rgba(99, 102, 241, 0.5) !important;
    box-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.15);
}

/* Error State Shake */
.form-card.has-error {
    border-color: #f43f5e !important;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #successModal, #successModal * {
        visibility: visible;
    }
    #successModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white !important;
        color: black !important;
    }
    #successModal > div {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        background: white !important;
        color: black !important;
    }
    #successModal button {
        display: none !important;
    }
}
