:root {
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --text-main: #212529;
    --text-muted: #6c757d;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --border-radius: 12px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    padding: 20px 0;
    line-height: 1.4;
    font-size: 0.8rem;
    /* Set base font size to 0.9rem */
}

/* Global Text Overrides for consistency */
p,
.btn,
.form-control,
.alert,
.list-group-item,
.modal-body {
    font-size: 0.8rem !important;
}

small,
.text-small,
.text-muted {
    font-size: 0.7rem !important;
}

/* Bootstrap Heading Overrides */
h1,
.h1 {
    font-size: 2.2rem;
}

h2,
.h2 {
    font-size: 1.7rem;
}

h3,
.h3 {
    font-size: 1.5rem;
}

h4,
.h4 {
    font-size: 1.3rem;
}

h5,
.h5 {
    font-size: 1.1rem;
}

h6,
.h6 {
    font-size: 0.9rem;
}

/* Container & Card */
.form-container {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.02);
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
}

.form-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.form-header img {
    max-height: 60px;
    margin-bottom: 20px;
}

.form-header h2 {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 1.5rem;
    /* Reduced from 1.75rem */
    letter-spacing: -0.5px;
}

.section-title {
    font-size: 1rem;
    /* Reduced from 1.1rem */
    font-weight: 600;
    color: #343a40;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary-color);
    background: rgba(13, 110, 253, 0.1);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.8rem;
    /* Reduced from 0.9rem */
}

/* Event Grid & Checkbox */
.event-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.event-grid.single-column {
    grid-template-columns: 1fr;
}

/* Hidden Checkbox Input */
.event-checkbox-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Event Card Label */
.event-card-label {
    display: flex;
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
    position: relative;
    overflow: hidden;
}

.event-card-label:hover {
    border-color: #a6c8ff;
    background-color: #f8fbff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.08);
}

/* Checked State */
.event-checkbox-input:checked+.event-card-label {
    border-color: var(--primary-color);
    background-color: #f0f7ff;
}

/* Custom Checkbox Indicator */
.custom-checkbox {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: 2px solid #adb5bd;
    border-radius: 4px;
    margin-right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    background: white;
    margin-top: 2px;
}

.event-checkbox-input:checked+.event-card-label .custom-checkbox {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    animation: bounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-checkbox::after {
    content: "\f00c";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: white;
    font-size: 12px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}

.event-checkbox-input:checked+.event-card-label .custom-checkbox::after {
    opacity: 1;
    transform: scale(1);
}

/* Event Details */
.event-content {
    flex: 1;
}

.event-name {
    font-weight: 600;
    font-size: 0.95rem;
    /* Reduced from 1.05rem */
    color: #212529;
    margin-bottom: 6px;
    display: block;
    line-height: 1.2;
}

.event-meta {
    font-size: 0.75rem;
    /* Reduced from 0.8rem */
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.event-topic {
    display: inline-block;
    font-size: 0.75rem;
    /* Reduced from 0.85rem */
    color: #495057;
    background: #e9ecef;
    padding: 4px 12px;
    border-radius: 10px;
    font-weight: 500;
}

/* Participant Type Selector */
.participant-type-wrapper {
    background: #f8f9fa;
    padding: 6px;
    border-radius: 12px;
    display: flex;
    gap: 6px;
}

.type-option {
    flex: 1;
    position: relative;
}

.type-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.type-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    border: 1px solid transparent;
    user-select: none;
    height: 100%;
}

.type-option input:checked+.type-label {
    background-color: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.type-option:hover .type-label {
    color: var(--text-main);
}

/* Form Inputs */
.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
    /* Reduced from 0.95rem */
    margin-bottom: 8px;
    color: #495057;
}

.required-field::after {
    content: "*";
    color: #dc3545;
    margin-left: 4px;
}

.form-control {
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #ced4da;
    font-size: 0.9rem;
    /* Reduced from 0.95rem */
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1);
}

/* Button */
.btn-submit {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    /* Reduced from 1rem */
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
    transition: var(--transition);
    margin-top: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.4);
}

.btn-submit:active {
    transform: translateY(0);
}

/* Loading Overlay */
#loadingOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    backdrop-filter: blur(2px);
}

.hidden {
    display: none !important;
}

@keyframes bounce {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* ============================================================
   RESPONSIVE: Mobile-first media queries
   ============================================================ */

/* Tablet and below */
@media (max-width: 768px) {
    body {
        padding: 12px 0;
    }

    .form-container {
        padding: 24px 20px;
        border-radius: 12px;
    }

    .form-header {
        margin-bottom: 16px;
    }

    .form-header h2 {
        font-size: 1.25rem;
    }

    /* Event grid: 1 column on tablet */
    .event-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .event-card-label {
        padding: 14px;
    }

    .event-name {
        font-size: 0.88rem;
    }

    /* Participant type: smaller padding */
    .type-label {
        padding: 10px 8px;
        font-size: 0.82rem;
    }

    /* Confirmation modal: full-width, remove side margins */
    .modal-dialog {
        margin: 8px;
    }

    .modal-body {
        padding: 16px !important;
    }

    /* Family member card: reduce padding */
    .family-member-card {
        padding: 14px;
    }

    /* Count row: stack vertically if needed */
    .family-count-row {
        gap: 10px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .form-container {
        padding: 16px 14px;
        border-radius: 0;
        box-shadow: none;
        border: none;
        min-height: 100vh;
    }

    .form-header h2 {
        font-size: 1.1rem;
    }

    /* Full-width container, no side gap */
    .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }

    .col-12 {
        padding-left: 0;
        padding-right: 0;
    }

    /* Event cards */
    .event-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .event-card-label {
        padding: 12px 10px;
    }

    .custom-checkbox {
        width: 20px;
        height: 20px;
        margin-right: 10px;
        flex-shrink: 0;
    }

    .event-name {
        font-size: 0.85rem;
    }

    .event-meta {
        gap: 6px;
        flex-direction: column;
        align-items: flex-start;
    }

    /* Participant type selector */
    .participant-type-wrapper {
        flex-direction: row; /* keep as row but tighter */
        gap: 4px;
        padding: 4px;
    }

    .type-label {
        padding: 8px 4px;
        font-size: 0.78rem;
        flex-direction: column;
        gap: 2px;
        text-align: center;
    }

    .type-label i {
        margin-right: 0 !important;
        font-size: 1rem;
    }

    /* Form inputs */
    .form-control {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .form-group label {
        font-size: 0.82rem;
        margin-bottom: 6px;
    }

    /* Bootstrap row columns: force single column */
    .row > [class*="col-md-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Member section */
    .section-title {
        font-size: 0.9rem;
        gap: 8px;
        margin-bottom: 14px;
    }

    /* Family info box */
    .family-info-box {
        padding: 10px 12px;
        font-size: 0.78rem;
    }

    /* Count row: stack on very small screens */
    .family-count-row {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .family-count-selector {
        flex: 1;
        justify-content: space-between;
        width: auto;
    }

    .family-count-btn {
        width: 38px;
        height: 38px;
    }

    .family-count-display {
        flex: 1;
        line-height: 38px;
        font-size: 0.85rem;
    }

    /* Size chart link */
    .size-chart-link {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    /* Kaos size pills: smaller, wrap naturally */
    .kaos-ukuran-wrapper,
    .kaos-model-wrapper {
        gap: 5px;
    }

    .kaos-option label {
        padding: 5px 9px;
        font-size: 0.75rem;
        min-width: 36px;
    }

    /* Family member card */
    .family-member-card {
        padding: 12px;
    }

    .family-member-header {
        margin-bottom: 12px;
    }

    /* Label+link row (label + size-chart link) */
    .d-flex.align-items-center.justify-content-between {
        flex-wrap: wrap;
        gap: 4px;
    }

    /* Submit button */
    .btn-submit {
        padding: 14px;
        font-size: 0.85rem;
    }

    /* Confirmation modal family grid: 1 column on mobile */
    #conf_family_list .row > .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* List group items in modal */
    .list-group-item {
        padding: 10px 12px;
    }

    /* Modal footer buttons */
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* Access Denied / Error Page Styles */
.card-error {
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    background: white;
}

.card-body-error {
    padding: 40px;
    text-align: center;
}

.icon-box-error {
    width: 80px;
    height: 80px;
    background: #ffebee;
    color: #dc3545;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
}

/* ============================================================
   Family Member Section Styles
   ============================================================ */

/* Info box */
.family-info-box {
    background: linear-gradient(135deg, #e8f4fd 0%, #dceefb 100%);
    border: 1px solid #b8ddf7;
    border-radius: 10px;
    padding: 14px 18px;
    color: #1a567e;
    font-size: 0.8rem;
    line-height: 1.2;
}

/* Count Row (selector + size-chart link side by side) */
.family-count-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Count Selector */
.family-count-selector {
    display: flex;
    align-items: center;
    gap: 0;
    width: fit-content;
    border: 1.5px solid #ced4da;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    margin-top: 6px;
}

/* Size Chart Link */
.size-chart-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--primary-color);
    text-decoration: none;
    padding: 6px 12px;
    border: 1.5px solid var(--primary-color);
    border-radius: 8px;
    transition: var(--transition);
    white-space: nowrap;
}

.size-chart-link:hover {
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
}

.family-count-btn {
    background: #f8f9fa;
    border: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--primary-color);
    transition: var(--transition);
}

.family-count-btn:hover:not(:disabled) {
    background: #e2eeff;
    color: var(--primary-hover);
}

.family-count-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.family-count-display {
    min-width: 48px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    border-left: 1.5px solid #dee2e6;
    border-right: 1.5px solid #dee2e6;
    padding: 0 8px;
    line-height: 44px;
}

/* Individual Family Member Card */
.family-member-card {
    background: #f8fbff;
    border: 1.5px solid #d0e6ff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    animation: slideInCard 0.3s ease;
}

.family-member-card:hover {
    border-color: #a6c8ff;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.07);
}

@keyframes slideInCard {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.family-member-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.family-member-badge {
    background: var(--primary-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.family-member-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #343a40;
    flex: 1;
}

/* T-shirt size options */
.kaos-model-wrapper,
.kaos-ukuran-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.kaos-option {
    position: relative;
}

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

.kaos-option label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border: 1.5px solid #ced4da;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: #495057;
    transition: var(--transition);
    white-space: nowrap;
    background: #fff;
    min-width: 44px;
}

.kaos-option input[type="radio"]:checked+label {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.25);
}

.kaos-option label:hover {
    border-color: #7aadff;
    background: #f0f7ff;
    color: var(--primary-color);
}

.kaos-option input[type="radio"]:checked+label:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

/* Confirmation modal family list */
.conf-family-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8fbff;
}

.conf-family-item .badge-num {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.conf-family-item .info {
    flex: 1;
}

.conf-family-item .info strong {
    display: block;
    font-size: 0.88rem;
    color: #212529;
}

.conf-family-item .info span {
    font-size: 0.8rem;
    color: #6c757d;
}
