/* HIB Frivilligportal - Premium Mobile-First Styling */

:root {
    --hib-primary: #2563eb;
    --hib-primary-hover: #1d4ed8;
    --hib-secondary: #f1f5f9;
    --hib-secondary-hover: #e2e8f0;
    --hib-text-main: #1e293b;
    --hib-text-muted: #64748b;
    --hib-bg: #ffffff;
    --hib-border: #e2e8f0;
    --hib-success: #10b981;
    --hib-error: #ef4444;
    --hib-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --hib-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --hib-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --hib-radius: 12px;
    --hib-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --hib-bg-alt: #fafafa;
    --hib-border-hover: #cbd5e1;
    --hib-card-bg: #ffffff;
    --hib-checked-bg: #eff6ff;
    --hib-pill-bg: #f8fafc;
}

.hib-frivillig-wrapper[data-theme="dark"] {
    --hib-primary: #3b82f6;
    --hib-primary-hover: #60a5fa;
    --hib-bg: #1e293b;
    --hib-bg-alt: #0f172a;
    --hib-card-bg: #334155;
    --hib-text-main: #f8fafc;
    --hib-text-muted: #94a3b8;
    --hib-secondary: #334155;
    --hib-secondary-hover: #475569;
    --hib-border: #475569;
    --hib-border-hover: #64748b;
    --hib-checked-bg: rgba(59, 130, 246, 0.15);
    --hib-pill-bg: #1e293b;
}

.hib-frivillig-wrapper[data-theme="custom"] {
    /* Custom colors injects bg, text-main, primary. We calculate variants for rest: */
    --hib-bg-alt: color-mix(in srgb, var(--hib-bg) 95%, black);
    --hib-card-bg: var(--hib-bg);
    --hib-border: color-mix(in srgb, var(--hib-bg) 85%, black);
    --hib-border-hover: color-mix(in srgb, var(--hib-bg) 75%, black);
    --hib-secondary: color-mix(in srgb, var(--hib-bg) 90%, black);
    --hib-secondary-hover: color-mix(in srgb, var(--hib-bg) 80%, black);
    --hib-text-muted: color-mix(in srgb, var(--hib-text-main) 65%, transparent);
    --hib-checked-bg: color-mix(in srgb, var(--hib-primary) 10%, transparent);
    --hib-pill-bg: color-mix(in srgb, var(--hib-bg) 95%, black);
}

.hib-frivillig-wrapper {
    max-width: 600px;
    margin: 2rem auto;
    font-family: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
    color: var(--hib-text-main);
    box-sizing: border-box;
}

.hib-frivillig-wrapper * {
    box-sizing: inherit;
}

.hib-wizard {
    background: var(--hib-bg);
    border-radius: var(--hib-radius);
    padding: 24px;
    box-shadow: var(--hib-shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Subtle glassmorphism effect */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: var(--hib-bg); /* Use solid color since glass isn't fully cross-theme safe without opacity calculation */
}

/* Progress Bar */
.hib-progress-container {
    position: relative;
    margin-bottom: 30px;
    height: 4px;
    background: var(--hib-secondary);
    border-radius: 4px;
}

.hib-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--hib-primary);
    border-radius: 4px;
    width: 25%;
    transition: width 0.4s ease-in-out;
}

.hib-step-indicator {
    display: flex;
    justify-content: space-between;
    position: absolute;
    top: -6px;
    left: 0;
    width: 100%;
}

.step-dot {
    width: 16px;
    height: 16px;
    background: var(--hib-secondary);
    border-radius: 50%;
    border: 2px solid var(--hib-bg);
    transition: var(--hib-transition);
}

.step-dot.active {
    background: var(--hib-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Steps */
.hib-step {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

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

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

.hib-step h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--hib-text-main);
}

.hib-subtitle {
    font-size: 0.95rem;
    color: var(--hib-text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Form Elements */
.hib-form-group {
    margin-bottom: 20px;
}

.hib-form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--hib-text-main);
}

.hib-form-group input[type="text"],
.hib-form-group input[type="email"],
.hib-form-group input[type="tel"],
.hib-form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--hib-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--hib-transition);
    background: var(--hib-bg-alt);
    color: var(--hib-text-main);
}

.hib-form-group input:focus,
.hib-form-group textarea:focus {
    outline: none;
    border-color: var(--hib-primary);
    background: var(--hib-card-bg);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Elegant Option Cards (Replaces checkboxes) */
.hib-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: flex-start;
}

.hib-option-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 16px;
    border: 1.5px solid var(--hib-border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--hib-card-bg);
    text-align: center;
    overflow: hidden;
}

.hib-option-card input {
    display: none;
}

.hib-option-text {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--hib-text-main);
    transition: var(--hib-transition);
    position: relative;
    z-index: 2;
}

/* Hover state */
.hib-option-card:hover {
    border-color: var(--hib-border-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.04);
}

/* Checked state */
.hib-option-card:has(input:checked) {
    border-color: var(--hib-primary);
    background: var(--hib-checked-bg);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

.hib-option-card:has(input:checked) .hib-option-text {
    color: var(--hib-primary);
    font-weight: 600;
}

/* Organisasjon Pills */
.hib-org-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.hib-org-pill {
    background: var(--hib-secondary);
    color: var(--hib-text-main);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.hib-org-pill:hover {
    background: var(--hib-secondary-hover);
    border-color: var(--hib-border-hover);
    transform: scale(1.02);
}

/* Buttons */
.hib-wizard-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    gap: 12px;
}

.hib-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--hib-transition);
    text-align: center;
    font-family: inherit;
}

.hib-btn-secondary {
    background: var(--hib-secondary);
    color: var(--hib-text-main);
}

.hib-btn-secondary:hover {
    background: var(--hib-secondary-hover);
}

.hib-next,
.hib-submit {
    background: var(--hib-primary);
    color: #fff;
}

.hib-next:hover,
.hib-submit:hover {
    background: var(--hib-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--hib-shadow-md);
}

/* Success Step */
.hib-step-success {
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.5s ease-out forwards;
}

.hib-success-icon {
    width: 64px;
    height: 64px;
    background: var(--hib-success);
    color: white;
    font-size: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px auto;
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0.2);
}

.hib-step-success h2 {
    font-size: 1.75rem;
    color: var(--hib-text-main);
    margin-bottom: 12px;
}

.hib-step-success p {
    color: var(--hib-text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Validation styling */
.hib-error-msg {
    color: var(--hib-error);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.3s ease-out;
}
.hib-error-msg svg {
    flex-shrink: 0;
}
.hib-input-error {
    border-color: var(--hib-error) !important;
    background: #fef2f2 !important;
}
.hib-grid-error .hib-option-card {
    border-color: #fca5a5;
    background: #fef2f2;
}
.hib-grid-error .hib-option-card:hover {
    border-color: var(--hib-error);
}

/* Loader */
.hib-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .hib-wizard {
        padding: 20px 16px;
        border-radius: 16px;
    }
    
    .hib-step h2 {
        font-size: 1.35rem;
    }
    
    .hib-wizard-actions {
        flex-direction: column-reverse;
    }
    
    .hib-btn {
        width: 100%;
    }
}

/* =========================================
   INTRO VIEW (Forside SPA)
========================================= */
.hib-intro,
.hib-event-info-view {
    background: var(--hib-bg);
    border-radius: var(--hib-radius);
    padding: 24px;
    box-shadow: var(--hib-shadow-lg);
    border: 1px solid rgba(128, 128, 128, 0.1);
    animation: fadeIn 0.4s ease-out forwards;
}
.hib-intro-image {
    width: 100%;
    margin-bottom: 30px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}
.hib-intro-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 350px;
}
.hib-intro-content {
    max-width: 600px;
    margin: 0 auto;
}
.hib-intro-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--hib-text-main);
    margin-bottom: 20px;
    line-height: 1.2;
    letter-spacing: -0.03em;
}
.hib-intro-text {
    font-size: 1.1rem;
    color: var(--hib-text-muted);
    line-height: 1.6;
    margin-bottom: 40px;
}
.hib-intro-select-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--hib-text-main);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--hib-bg);
    padding-bottom: 10px;
}
.hib-event-cards {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 30px;
}
.hib-event-card-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--hib-card-bg);
    border: 2px solid var(--hib-border);
    padding: 20px 25px;
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.hib-event-card-btn:hover {
    border-color: var(--hib-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(37, 99, 235, 0.1);
}
.hib-event-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--hib-text-main);
}
.hib-event-card-arrow {
    font-size: 1.5rem;
    color: var(--hib-primary);
    font-weight: bold;
    transition: transform 0.2s ease;
}
.hib-event-card-btn:hover .hib-event-card-arrow {
    transform: translateX(5px);
}

/* =========================================
   KAPASITET & RESERVELISTE
========================================= */
.hib-option-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.hib-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    animation: fadeIn 0.3s ease-out;
}
.hib-pill-green {
    background-color: #dcfce7;
    color: #166534;
}
.hib-pill-orange {
    background-color: #fef9c3;
    color: #854d0e;
    box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.4);
}
.hib-pill-red {
    background-color: #fee2e2;
    color: #991b1b;
}

.hib-shift-full {
    background: var(--hib-pill-bg);
    border-color: var(--hib-border);
}
.hib-shift-full .hib-option-text {
    color: var(--hib-text-muted);
}
.hib-shift-full:hover {
    border-color: var(--hib-border-hover);
    transform: none;
    box-shadow: none;
}
.hib-shift-full:has(input:checked) {
    border-color: #ef4444;
    background: #fff5f5;
    transform: none;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
}
.hib-shift-full:has(input:checked) .hib-option-text {
    color: #b91c1c;
}

/* =========================================
   TREKKSPILL (ACCORDION) FOR GRUPPER
========================================= */
.hib-accordion-group {
    border: 1px solid var(--hib-border);
    border-radius: 12px;
    margin-bottom: 12px;
    background: var(--hib-card-bg);
    overflow: hidden;
    transition: all 0.2s ease;
}
.hib-accordion-group:hover {
    border-color: var(--hib-border-hover);
}
.hib-accordion-group.has-selection {
    border-color: var(--hib-primary);
    box-shadow: 0 0 0 1px var(--hib-primary);
}

.hib-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    background: var(--hib-pill-bg);
    user-select: none;
    transition: background 0.2s ease;
}
.hib-accordion-header:hover {
    background: var(--hib-secondary);
}

.hib-accordion-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--hib-text-main);
}

.hib-accordion-check {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid var(--hib-border-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all 0.2s ease;
}
.hib-accordion-group.has-selection .hib-accordion-check {
    background: var(--hib-primary);
    border-color: var(--hib-primary);
    color: #fff;
}

.hib-accordion-icon {
    color: var(--hib-text-muted);
    transition: transform 0.3s ease;
}
.hib-accordion-group.active .hib-accordion-icon {
    transform: rotate(180deg);
}

.hib-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: var(--hib-card-bg);
}
.hib-accordion-group.active .hib-accordion-content {
    max-height: 2000px;
}

.hib-options-grid-nested {
    padding: 16px 20px 24px 20px;
    gap: 12px;
}
.hib-options-grid-nested .hib-option-card {
    padding: 16px; /* Litt nettere kort inni gruppene */
}

/* =========================================
   INFO VIEW (Arrangementbeskrivelse)
========================================= */
.hib-info-card {
    background: var(--hib-card-bg);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.4s ease-out;
}
@media (max-width: 640px) {
    .hib-info-card {
        padding: 24px;
    }
}
.hib-frivillig-wrapper .hib-info-main-title {
    color: var(--hib-text-main);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    margin-top: 0;
}
.hib-info-content-area {
    color: var(--hib-text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
}
.hib-frivillig-wrapper .hib-info-content-area h1,
.hib-frivillig-wrapper .hib-info-content-area h2,
.hib-frivillig-wrapper .hib-info-content-area h3 {
    color: var(--hib-text-main);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 700;
}
.hib-frivillig-wrapper .hib-info-content-area p {
    color: var(--hib-text-muted);
    margin-bottom: 1em;
}
.hib-info-content-area ul,
.hib-info-content-area ol {
    margin-bottom: 1.5em;
    padding-left: 20px;
}
.hib-frivillig-wrapper .hib-info-content-area li {
    color: var(--hib-text-muted);
    margin-bottom: 0.5em;
}
.hib-info-content-area a {
    color: var(--hib-primary);
    text-decoration: underline;
}

/* CTA Button on Info View */
.hib-btn-cta {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    padding: 18px 30px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hib-btn-cta svg {
    transition: transform 0.3s ease;
}
.hib-btn-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}
.hib-btn-cta:hover svg {
    transform: translateX(4px);
}
.hib-btn-cta:active {
    transform: translateY(1px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
}

/* Back Buttons */
.hib-back-btn {
    background: var(--hib-secondary);
    border: none;
    color: var(--hib-text-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 30px;
    transition: all 0.2s ease;
}
.hib-back-btn:hover {
    background: var(--hib-secondary-hover);
    transform: translateX(-4px);
}
