/* CSS styling som er spesifikk for brukerprofilen */


/* Sentraler profilboksen */
.user-profile {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px;
}

.user-profile-box {
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    background: var(--card-bg);
    padding: 40px;
    border: 1px solid #f0f0f0;
    transition: var(--transition);
}

.user-profile-box:hover {
    box-shadow: var(--box-shadow-hover);
}

/* Form group styling for bedre plassering */
.user-profile-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.user-profile-group label {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--primary-color);
}

/* Styling for inndelinger, som "endre passord" */
.section-divider {
    border-top: 1px solid var(--secondary-color);
    padding-top: 15px;
    margin-top: 15px;
}

.options-inline {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    align-items: center;
}

/* For å gjøre teksten under hver seksjon bedre lesbar */
.description {
    margin-top: 5px;
    font-size: 0.9rem;
    color: #666;
}

/* Tooltip info icon */
.info-icon {
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 4px;
    position: relative;
    user-select: none;
}

.info-icon::after {
    content: attr(data-info);
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: normal;
    width: 240px;
    z-index: 10;
}

.info-icon:hover::after,
.info-icon:focus::after {
    display: block;
}

/* Kort for forhåndsvisning av profil */
.profile-card {
    width: 100%;
    max-width: 400px;
    margin: auto;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 32px;
    text-align: center;
    font-family: var(--font-family);
    border: 1px solid #f0f0f0;
    transition: var(--transition);
}

.profile-card:hover {
    box-shadow: var(--box-shadow-hover);
    transform: translateY(-2px);
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.profile-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
}

.profile-image {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 1rem;
}

.profile-info p {
    margin: 0;
}

.profile-info strong {
    font-weight: 600;
}

.profile-color-settings {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.profile-color-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
}

.profile-color-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--input-border);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    font-size: 0.9rem;
    background: var(--input-bg);
    color: var(--text-color);
}

.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.avatar-wrapper {
    position: relative;
    cursor: pointer;
}

.camera-icon {
    position: absolute;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border-radius: 50%;
    padding: 4px;
    font-size: 20px;
}

#avatar {
    display: none;
}

/* Row layout for turnus og første skift */
.form-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.form-row .form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Spacing for floating rig row */
#floating-rig-row {
    margin-top: 12px;
    margin-bottom: 12px;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Ensure button row stacks on mobile for better symmetry */
    .button-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .button-row .btn,
    .button-row .btn-secondary {
        width: 100%;
    }
    
    /* Ensure all buttons have consistent spacing on mobile */
    .user-profile .btn,
    .user-profile .btn-secondary,
    #delete-profile-btn {
        width: 100%;
    }
}

/* Grå ut deaktiverte felt */
.user-profile input:disabled,
.user-profile select:disabled {
    background-color: #eee;
    cursor: not-allowed;
}

.avatar-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
    justify-content: center;
    font-size: 48px;
    overflow: hidden;
}

.password-link {
    margin-top: 5px;
    display: inline-block;
}

#preview-btn {
    margin-top: 0;
}

/* Konsistent knappestyling for profilsiden - bruker original .btn og .btn-secondary fra style.css */
/* Men sørger for at alle knapper har samme størrelse og styling */
.user-profile .btn,
.user-profile .btn-secondary {
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Override hover effect for "Lagre profil" button - keep text visible */
.user-profile .btn[type="submit"] {
    position: relative;
}

.user-profile .btn[type="submit"]::before {
    display: none; /* Remove the sliding orange overlay */
}

.user-profile .btn[type="submit"]:hover {
    background: linear-gradient(135deg, #d68910 0%, #b9770e 100%); /* Darker orange on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(244, 163, 0, 0.3);
}

.user-profile .btn[type="submit"] > * {
    position: relative;
    z-index: 1;
}

/* Fare knapp (Slett profil) - rød knapp for destruktive handlinger */
.user-profile .btn-danger,
#delete-profile-btn {
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px; /* Add spacing above delete button */
    margin-bottom: 12px;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    color: var(--light-color) !important;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3) !important;
    border: none !important;
    cursor: pointer;
    transition: var(--transition);
}

.user-profile .btn-danger:hover,
#delete-profile-btn:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4) !important;
}

/* Button row for side-by-side buttons */
.button-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 20px; /* Add spacing below button row */
}

.button-row .btn,
.button-row .btn-secondary {
    margin-bottom: 0;
    flex: 1;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 15px;
    padding: 14px 16px;
}

/* Avviksseksjon styling */
#deviation-section {
    margin-bottom: 16px;
}

#deviation-section:last-child {
    margin-bottom: 0;
}

.deviation-card {
    margin-top: 16px;
    padding: 24px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid #f0f0f0;
    box-shadow: var(--box-shadow);
    display: none;
}

.deviation-card.visible {
    display: block;
}

.deviation-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.deviation-card .form-group {
    margin-bottom: 20px;
}

.deviation-card label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--primary-color);
}

.deviation-card input[type="date"],
.deviation-card select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--input-border);
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    background: var(--input-bg);
    transition: var(--transition);
    font-family: var(--font-family);
}

.deviation-card input[type="date"]:focus,
.deviation-card select:focus {
    border-color: var(--accent-color);
    outline: none;
    background: var(--light-color);
    box-shadow: 0 0 0 3px rgba(244, 163, 0, 0.1);
}

/* Remove default section margins since profile-section handles it */
.user-profile > section {
    margin-bottom: 0;
}

.user-profile .profile-section:last-of-type {
    margin-bottom: 0;
}

/* Profile section containers with visual separation */
.profile-section {
    padding: 24px;
    margin-bottom: 24px;
    background: rgba(244, 163, 0, 0.03);
    border-radius: var(--border-radius);
    border: 1px solid rgba(244, 163, 0, 0.15);
    position: relative;
}

.profile-section::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--accent-color) 0%, rgba(244, 163, 0, 0.5) 100%);
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

/* Image section specific styling */
.image-section {
    text-align: center;
}

/* Spacing for avatar section */
.avatar-section {
    margin-bottom: 0;
}

/* Name and password section */
.name-password-section {
    background: rgba(52, 152, 219, 0.03);
    border-color: rgba(52, 152, 219, 0.15);
}

.name-password-section::before {
    background: linear-gradient(180deg, #3498db 0%, rgba(52, 152, 219, 0.5) 100%);
}

/* Styling for link buttons that should look like btn-secondary */
.name-password-section a.btn-secondary {
    display: block;
    text-decoration: none;
    margin-top: 12px;
    /* Override any link styling to match button appearance */
    color: var(--primary-color) !important;
    background-color: var(--light-color) !important;
    border: 2px solid var(--secondary-color) !important;
    text-align: center;
    transition: var(--transition);
}

.name-password-section a.btn-secondary:hover {
    text-decoration: none;
    background-color: var(--accent-color) !important;
    color: var(--light-color) !important;
    border-color: var(--accent-color) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(244, 163, 0, 0.2);
}

/* Work section styling */
.work-section {
    background: rgba(46, 204, 113, 0.03);
    border-color: rgba(46, 204, 113, 0.15);
}

.work-section::before {
    background: linear-gradient(180deg, #2ecc71 0%, rgba(46, 204, 113, 0.5) 100%);
}

/* Buttons section styling */
.buttons-section {
    background: rgba(155, 89, 182, 0.03);
    border-color: rgba(155, 89, 182, 0.15);
}

.buttons-section::before {
    background: linear-gradient(180deg, #9b59b6 0%, rgba(155, 89, 182, 0.5) 100%);
}

/* Cropper modal adjustments */
#cropper-modal .cropper-content {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow-hover);
    border: 1px solid #f0f0f0;
}

#cropper-canvas {
    max-width: 400px;
    max-height: 60vh;
    display: block;
    margin: 0 auto 10px auto;
    cursor: crosshair;
    touch-action: none;
}

/* Email preference toggle switch - matching "Nær kollega" style */
.email-preference-label {
    font-size: 0.95rem !important;
    white-space: nowrap !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    cursor: pointer !important;
    user-select: none !important;
    position: relative !important;
    padding-left: 52px !important;
    min-height: 24px !important;
    line-height: 24px !important;
}

/* Hide the default checkbox completely */
.email-preference-label input[type="checkbox"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    display: none !important;
    visibility: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
}

/* Toggle switch track */
.email-preference-label::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 44px !important;
    height: 24px !important;
    background: var(--input-border) !important;
    border-radius: 12px !important;
    transition: var(--transition) !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    z-index: 1 !important;
    display: block !important;
    visibility: visible !important;
}

/* Toggle switch thumb */
.email-preference-label::after {
    content: '' !important;
    position: absolute !important;
    left: 2px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 20px !important;
    height: 20px !important;
    background: var(--light-color) !important;
    border-radius: 50% !important;
    transition: var(--transition) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    pointer-events: none !important;
    z-index: 2 !important;
    display: block !important;
    visibility: visible !important;
}

/* Checked state - switch ON (orange/yellow) */
.email-preference-label:has(input[type="checkbox"]:checked)::before,
.email-preference-label.checked::before {
    background: var(--accent-color) !important;
}

.email-preference-label:has(input[type="checkbox"]:checked)::after,
.email-preference-label.checked::after {
    left: 22px !important;
    background: var(--light-color) !important;
}

/* Hover state */
.email-preference-label:hover::before {
    box-shadow: 0 0 0 4px rgba(244, 163, 0, 0.1) !important;
}

/* Active/pressed state */
.email-preference-label:active::after {
    width: 22px !important;
}

/* Help text styling for turnus selection */
.help-text {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 0.875rem;
    line-height: 1.4;
}

.help-text a {
    color: var(--accent-color);
    text-decoration: underline;
    transition: var(--transition);
}

.help-text a:hover {
    color: var(--accent-color-dark);
    text-decoration: none;
}

/* Turnus på profil-/kollegakort: egendefinert PATTERN (manuell) */
.shift-display.shift-display--custom {
    display: inline;
    padding: 3px 10px;
    border-radius: 8px;
    background: rgba(244, 163, 0, 0.14);
    border: 1px solid rgba(244, 163, 0, 0.35);
    color: var(--text-color, #333);
}

.shift-display__text {
    font-weight: 500;
}
