/* ============================================================
   Seminar Usahawan Sejahtera Kuala Nerus
   Global Stylesheet — Black & White Theme
   ============================================================ */

:root {
    --black: #000;
    --white: #fff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-600: #6c757d;
    --gray-800: #343a40;
    --danger: #b00020;
}

* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
    background: var(--white);
    color: var(--black);
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    background: var(--black);
    color: var(--white);
    padding: 2rem 1rem;
    text-align: center;
    border-bottom: 4px solid var(--black);
}

.hero h1 {
    font-size: clamp(1.25rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
    word-break: break-word;
}

.hero .subtitle {
    font-size: clamp(0.85rem, 2vw, 1.05rem);
    opacity: 0.85;
    margin-bottom: 0;
}

.event-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.25rem;
}

.event-badge {
    background: var(--white);
    color: var(--black);
    padding: 0.5rem 0.9rem;
    border-radius: 50px;
    font-size: clamp(0.75rem, 1.8vw, 0.875rem);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

/* ============================================================
   CARDS
   ============================================================ */
.form-card,
.content-card {
    background: var(--white);
    border: 2px solid var(--black);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-card h2 {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--black);
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--black);
    display: block;
}

.form-control,
.form-select {
    border: 2px solid var(--black);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    font-size: 1rem;
    background: var(--white);
    color: var(--black);
    width: 100%;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--black);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
    background: var(--white);
    color: var(--black);
    outline: none;
}

.form-control::placeholder {
    color: var(--gray-600);
    opacity: 0.85;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-select:disabled {
    background-color: var(--gray-100);
    opacity: 0.7;
    cursor: not-allowed;
}

/* MyKad monospace input */
#f_no_mykad {
    font-family: 'Courier New', 'SF Mono', Consolas, monospace;
    letter-spacing: 0.5px;
    font-weight: 600;
    font-size: 1.05rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-black {
    background: var(--black);
    color: var(--white);
    border: 2px solid var(--black);
    padding: 0.85rem 1.5rem;
    font-weight: 700;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    line-height: 1.2;
}

.btn-black:hover,
.btn-black:focus {
    background: var(--white);
    color: var(--black);
    outline: none;
}

.btn-black:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-outline-black {
    background: var(--white);
    color: var(--black);
    border: 2px solid var(--black);
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    line-height: 1.2;
}

.btn-outline-black:hover,
.btn-outline-black:focus {
    background: var(--black);
    color: var(--white);
    outline: none;
}

/* ============================================================
   IMAGE UPLOAD
   ============================================================ */
.upload-box {
    border: 2px dashed var(--black);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease;
    background: var(--gray-100);
    position: relative;
    overflow: hidden;
}

.upload-box:hover {
    background: var(--gray-200);
}

.upload-box i {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    display: block;
}

.upload-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    border: 2px solid var(--black);
    margin-top: 0.75rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    object-fit: contain;
}

/* ============================================================
   ADMIN TABLES
   ============================================================ */
.table-black {
    background: var(--white);
    color: var(--black);
    width: 100%;
    border-collapse: collapse;
}

.table-black th {
    background: var(--black);
    color: var(--white);
    font-weight: 700;
    padding: 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
    text-align: left;
    vertical-align: middle;
}

.table-black td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-300);
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-black tbody tr:hover {
    background: var(--gray-100);
}

.table-responsive {
    border-radius: 10px;
    border: 2px solid var(--black);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.table-responsive table {
    margin-bottom: 0;
}

/* ============================================================
   PROFILE
   ============================================================ */
.profile-header {
    background: var(--black);
    color: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 1.25rem;
}

.profile-header .avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--white);
    object-fit: cover;
    margin-bottom: 0.75rem;
    background: var(--gray-200);
}

.profile-header .special-id {
    font-family: 'Courier New', monospace;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    background: var(--white);
    color: var(--black);
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    display: inline-block;
    margin-top: 0.5rem;
    font-weight: 700;
    word-break: break-all;
    letter-spacing: 0.5px;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-300);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
}

.detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--black);
    word-break: break-word;
    line-height: 1.5;
}

/* ============================================================
   SUCCESS PAGE
   ============================================================ */
.success-icon {
    font-size: 4rem;
    color: var(--black);
    margin-bottom: 1rem;
    display: block;
}

.qr-container {
    text-align: center;
    padding: 1.25rem;
    background: var(--white);
    border: 3px solid var(--black);
    border-radius: 12px;
    margin: 1.25rem 0;
}

.qr-container img {
    max-width: 100%;
    height: auto;
    width: 220px;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: default;
    transition: transform 0.2s ease;
    display: block;
    margin: 0 auto;
}

.qr-container img:active {
    transform: scale(0.98);
}

/* ============================================================
   QR ACTIONS
   ============================================================ */
.qr-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.qr-actions .btn-black,
.qr-actions .btn-outline-black {
    flex: 1 1 auto;
    min-width: 160px;
    font-size: 0.85rem;
    padding: 0.55rem 0.9rem;
    width: auto;
}

@media (max-width: 360px) {
    .qr-actions .btn-black,
    .qr-actions .btn-outline-black {
        min-width: 100%;
    }
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert-black {
    background: var(--black);
    color: var(--white);
    border: 2px solid var(--black);
    border-radius: 8px;
    padding: 1rem;
    font-weight: 500;
}

.alert-outline {
    background: var(--white);
    color: var(--black);
    border: 2px solid var(--black);
    border-radius: 8px;
    padding: 1rem;
    font-weight: 500;
}

/* ============================================================
   ADMIN NAV
   ============================================================ */
.admin-nav {
    background: var(--black);
    color: var(--white);
    padding: 0.9rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.admin-nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--white);
    color: var(--black);
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--black);
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 420px;
}

/* ============================================================
   MULTI-STEP FORM WIZARD
   ============================================================ */
.wizard-progress {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    position: relative;
    padding: 0 0.25rem;
}

.wizard-progress::before {
    content: '';
    position: absolute;
    top: 22px;
    left: 10%;
    right: 10%;
    height: 3px;
    background: var(--gray-300);
    z-index: 0;
}

.wizard-progress-fill {
    position: absolute;
    top: 22px;
    left: 10%;
    height: 3px;
    background: var(--black);
    z-index: 1;
    transition: width 0.35s ease;
    width: 0;
}

.wizard-step-indicator {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
}

.wizard-step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--white);
    border: 3px solid var(--gray-300);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.wizard-step-indicator.active .wizard-step-circle {
    border-color: var(--black);
    background: var(--black);
    color: var(--white);
    transform: scale(1.08);
}

.wizard-step-indicator.completed .wizard-step-circle {
    border-color: var(--black);
    background: var(--white);
    color: var(--black);
}

.wizard-step-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    color: var(--gray-600);
    line-height: 1.2;
    padding: 0 0.15rem;
    word-break: break-word;
}

.wizard-step-indicator.active .wizard-step-label,
.wizard-step-indicator.completed .wizard-step-label {
    color: var(--black);
}

@media (min-width: 768px) {
    .wizard-step-label {
        font-size: 0.8rem;
    }
    .wizard-step-circle {
        width: 52px;
        height: 52px;
        font-size: 1.05rem;
    }
    .wizard-progress::before,
    .wizard-progress-fill {
        top: 26px;
    }
}

.wizard-step {
    display: none;
    animation: wizardFadeIn 0.3s ease;
}

.wizard-step.active {
    display: block;
}

@keyframes wizardFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wizard-step-title {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.wizard-step-subtitle {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.wizard-nav {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-top: 1rem;
}

.wizard-nav .btn-black,
.wizard-nav .btn-outline-black {
    flex: 1;
    min-width: 0;
}

@media (min-width: 576px) {
    .wizard-nav .btn-black,
    .wizard-nav .btn-outline-black {
        flex: 0 0 auto;
        min-width: 140px;
    }
}

/* ============================================================
   REVIEW PANEL
   ============================================================ */
.review-list {
    background: var(--gray-100);
    border: 2px solid var(--black);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.review-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--gray-300);
    font-size: 0.9rem;
}

.review-item:last-child {
    border-bottom: none;
}

.review-item-label {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--gray-600);
    flex: 0 0 40%;
    max-width: 40%;
}

.review-item-value {
    font-weight: 600;
    color: var(--black);
    word-break: break-word;
    text-align: right;
    flex: 1;
    line-height: 1.5;
}

.review-img {
    max-width: 90px;
    max-height: 90px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--black);
    display: inline-block;
}

.review-section-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--black);
}

/* ============================================================
   INLINE FIELD ERRORS
   ============================================================ */
.field-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: none;
    font-weight: 500;
}

.form-control.is-invalid-custom,
.form-select.is-invalid-custom,
textarea.is-invalid-custom {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(176, 0, 32, 0.15);
}

.field-error.show {
    display: block;
}

/* ============================================================
   SUBMIT OVERLAY
   ============================================================ */
.submit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    color: var(--white);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
    gap: 1rem;
    padding: 1rem;
    text-align: center;
}

.submit-overlay.show {
    display: flex;
}

.submit-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.35rem;
}

.submit-overlay h4 {
    font-weight: 700;
    margin: 0;
}

.submit-overlay p {
    opacity: 0.8;
    margin: 0;
    font-size: 0.9rem;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    padding: 1.5rem 1rem;
    margin-top: 1.5rem;
    background: var(--black);
    color: var(--white);
    text-align: center;
    font-size: 0.875rem;
    line-height: 1.6;
}

footer strong {
    font-weight: 700;
}

footer p {
    margin-bottom: 0.25rem;
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

code {
    background: var(--gray-100);
    color: var(--black);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

small.text-muted,
.text-muted {
    color: var(--gray-600) !important;
}

/* ============================================================
   RESPONSIVE — MOBILE FIRST
   ============================================================ */

/* Small phones (base styles) — 320px - 575px */

/* Large phones / small tablets */
@media (min-width: 576px) {
    .hero {
        padding: 3rem 1.5rem;
    }
    .form-card,
    .content-card {
        padding: 1.75rem;
    }
    .btn-black {
        width: auto;
        min-width: 200px;
    }
    .qr-container img {
        width: 240px;
    }
}

/* Tablets */
@media (min-width: 768px) {
    .hero {
        padding: 3.5rem 2rem;
    }
    .form-card,
    .content-card {
        padding: 2rem;
    }
    .qr-container img {
        width: 260px;
    }
    .profile-header .avatar {
        width: 120px;
        height: 120px;
    }
}

/* Small laptops */
@media (min-width: 992px) {
    .hero {
        padding: 4rem 2rem;
    }
    .form-card,
    .content-card {
        padding: 2.5rem;
    }
    .qr-container img {
        width: 300px;
    }
}

/* Large laptops / desktops */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Large desktop */
@media (min-width: 1400px) {
    .container {
        max-width: 1140px;
    }
}

/* FHD Desktop / TV */
@media (min-width: 1920px) {
    body {
        font-size: 18px;
    }
    .container {
        max-width: 1400px;
    }
    .hero h1 {
        font-size: 3rem;
    }
    .form-card,
    .content-card {
        padding: 3rem;
    }
}

/* 4K TV */
@media (min-width: 2560px) {
    body {
        font-size: 20px;
    }
    .container {
        max-width: 1800px;
    }
    .hero h1 {
        font-size: 3.5rem;
    }
    .wizard-step-circle {
        width: 64px;
        height: 64px;
        font-size: 1.25rem;
    }
    .form-control,
    .form-select {
        font-size: 1.1rem;
        padding: 1rem 1.15rem;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .no-print,
    .admin-nav,
    .wizard-progress,
    .wizard-nav,
    .qr-actions,
    .submit-overlay,
    footer,
    button,
    .btn-black,
    .btn-outline-black {
        display: none !important;
    }

    body {
        background: var(--white) !important;
        color: var(--black) !important;
        font-size: 12pt;
    }

    .form-card,
    .content-card {
        border: 2px solid var(--black) !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .qr-container {
        border: 3px solid var(--black) !important;
        page-break-inside: avoid;
    }

    a {
        color: var(--black) !important;
        text-decoration: none;
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visibility for keyboard users */
.btn-black:focus-visible,
.btn-outline-black:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
a:focus-visible {
    outline: 3px solid var(--black);
    outline-offset: 2px;
}

/* Better tap targets on touch devices */
@media (hover: none) and (pointer: coarse) {
    .btn-black,
    .btn-outline-black,
    .admin-nav a {
        min-height: 44px;
    }
}