/* Font-face declarations are in /assets/css/style.css (shared) */

:root {
    --skriv-bg: #F8F8F8;
    --skriv-card-bg: #FFFFFF;
    --skriv-border: #E0E0E0;
    --skriv-teal: #5F9EA0;
    --skriv-teal-hover: #5f9fa6;
    --skriv-text: #333333;
    --skriv-text-muted: #555555;
    --skriv-placeholder: #A0A0A0;
    --skriv-icon-bg: #F0F0F0;
    --skriv-icon-color: #808080;
    --skriv-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --skriv-shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.04);
    --skriv-radius: 6px;
    --skriv-header-radius: 8px;
}

/* Shared sidebar/layout styles are in /assets/css/style.css */

/* ----- Cards (white, shadow). No standalone header; first card has teal prompt bar attached. ----- */
.skriv-card {
    margin-bottom: 10px;
    overflow: hidden;
}

/* Teal bar attached to top of first card only */
.skriv-card-recipient .skriv-card-prompt {
    background: var(--skriv-teal);
    color: #fff;
    padding: 0.75rem 1.25rem;
    font-size: 17px;
    font-weight: 700;
    border-radius: var(--skriv-radius) var(--skriv-radius) 0 0;
}



.skriv-input {
    width: 100%;
    border: 1px solid var(--skriv-border);
    outline: none;
    background: #fff;
    font-size: 14px;
    line-height: 1.4;
    color: var(--skriv-text);
    resize: none;
    display: block;
    padding: 10px 12px;
    border-radius: 4px;
    box-shadow: none;
}

.skriv-input::placeholder {
    color: var(--skriv-placeholder);
}

.skriv-input-single {
    min-height: 100px !important;
    border: 1px solid var(--skriv-border) !important;
    color: var(--skriv-text) !important;
}

.skriv-textarea {
    min-height: 200px !important;
}

.skriv-card-icon-button-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0 20px 0;
    padding-top: 0;
}

/* Icons row outside textarea (below it, still in card) */
.skriv-card-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.skriv-card-icons-top {
    margin: 10px 0 20px 0;
    padding-top: 0;
}

/* Icon buttons: match korrektur-control-btn (white, border, subtle shadow) */
.skriv-control-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid rgb(220, 220, 220);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    color: #555555;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.skriv-control-btn:hover {
    border: 1px solid rgb(202, 202, 202);
    background: #f8f8f8;
}

.skriv-control-btn svg {
    flex-shrink: 0;
}

/* TTS loading spinner (in place of speaker icon while request is in progress) */
.tts-loader {
    display: inline-flex;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #555;
    border-radius: 50%;
    animation: tts-spin 0.7s linear infinite;
}

@keyframes tts-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ----- Control panel: label + Skriv teksten button + slider ----- */
/* .skriv-control-panel {
    margin: 1rem 0;
} */

/* .skriv-control-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
} */

.skriv-control-label {
    font-size: 14px;
    font-weight: 400;
    color: var(--skriv-text-muted);
}

.skriv-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 34px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    background: var(--skriv-teal) !important;
    background-image: none !important;
    color: #fff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.skriv-submit-btn:hover:not(:disabled) {
    background: var(--skriv-teal-hover) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 34px;
    border-radius: 6px;
}

.skriv-submit-btn:disabled {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 34px;
    border-radius: 6px;
    background: var(--skriv-card-bg) !important;
    color: #666 !important;
    border: 1px solid rgb(220, 220, 220) !important;
    box-shadow: none;
    cursor: default;
}

.skriv-slider-wrap {
    display: flex;
    flex-direction: column;
}

.skriv-slider-label-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skriv-slider-label {
    font-size: 14px;
    color: var(--skriv-text-muted);
}

.skriv-range {
    flex: 1;
    min-width: 0;
    height: 27px;
    -webkit-appearance: none;
    appearance: none;
    margin: 1rem 0;
    background: none;
}

.skriv-range:focus {
    outline: none;
}

.skriv-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 10px;
    cursor: pointer;
    background: #D0D0D0;
    border-radius: 5px;
}

.skriv-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 32px;
    height: 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    margin-top: -2px;
}

.skriv-range::-moz-range-track {
    width: 100%;
    height: 10px;
    cursor: pointer;
    background: #D0D0D0;
    border-radius: 5px;
}

.skriv-range::-moz-range-thumb {
    width: 32px;
    height: 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    cursor: pointer;
}

/* ----- Result section (output card) ----- */
.page-4Section {
    margin-top: 20px;
    padding: 20px 0 0 0;
}

.paragraph-wrapper #paragraph1CV,
.paragraph-wrapper textarea.content,
#paragraph1CV {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    box-sizing: border-box;
    border: 1px solid var(--skriv-border);
    border-radius: 8px;
    outline: none;
    font-size: 14px;
    line-height: 1.4;
    background: #fff;
    color: var(--skriv-text);
    box-shadow: none;
    resize: none;
}

.paragraph-wrapper #paragraph1CV::placeholder,
.paragraph-wrapper textarea.content::placeholder {
    color: var(--skriv-placeholder);
}

.paragraph-wrapper #paragraph1CV:focus,
.paragraph-wrapper textarea.content:focus {
    border-color: var(--skriv-text-muted);
    outline: none;
}

/* Rewrite reason overlay */
.rewrite-reason-div {
    display: none;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(248, 248, 248, 0.97);
    backdrop-filter: blur(2px);
    box-sizing: border-box;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 1.5rem;
    border-radius: var(--skriv-radius);
    border: 1px solid var(--skriv-border);
    box-shadow: var(--skriv-shadow-subtle);
}

.rewrite-reason-div textarea,
#rewrite-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    box-sizing: border-box;
    border: 1px solid var(--skriv-border);
    border-radius: 8px;
    outline: none;
    font-size: 14px;
    line-height: 1.4;
    background: #fff;
    color: var(--skriv-text);
    box-shadow: none;
    resize: none;
    margin-bottom: 12px;
}

.rewrite-reason-div textarea::placeholder,
#rewrite-textarea::placeholder {
    color: var(--skriv-placeholder);
}

.rewrite-reason-div>div {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    align-self: flex-end;
}

.rewrite-reason-div .btn-skip {
    height: 38px;
    min-width: 38px;
    padding: 8px 14px;
    border-radius: var(--skriv-radius);
    font-size: 14px;
    font-weight: 500;
    background: #fff;
    color: #3c3c3c;
    border: 1px solid var(--skriv-border);
    box-shadow: var(--skriv-shadow-subtle);
    cursor: pointer;
}

.rewrite-reason-div .btn-rewrite {
    height: 38px;
    padding: 8px 14px;
    border-radius: var(--skriv-radius);
    font-size: 14px;
    font-weight: 500;
    background: var(--skriv-teal);
    color: #fff;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: pointer;
}

.rewrite-reason-div .btn-rewrite:hover {
    background: var(--skriv-teal-hover);
}

/* Footer action bar */
.icons-control-div {
    margin-top: 9px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.textarea-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.response-navigation {
    display: flex;
    align-items: center;
    color: #555555;
    font-size: 14px;
}

.response-counter {
    font-size: 14px;

}

.response-navigation button {
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0 !important;
    color: var(--skriv-icon-color);
}

.response-navigation button svg {
    color: #4a4a4a !important;
}

.response-navigation button:hover:not(:disabled) {
    color: var(--skriv-text-muted);
}

.response-navigation button:disabled {
    cursor: default;
}

/* Footer icons: same style as korrektur-control-btn */
.skriv-footer-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid rgb(220, 220, 220);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    color: #555555;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.skriv-footer-btn:hover {
    border: 1px solid rgb(202, 202, 202);
    background: #f8f8f8;
}

.skriv-footer-btn svg {
    flex-shrink: 0;
}

.rewrite-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
    height: 34px;
    border-radius: var(--skriv-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    background: var(--skriv-teal) !important;
    background-image: none !important;
    color: #fff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.rewrite-btn:hover {
    background: var(--skriv-teal-hover) !important;
}

#genBtn span {
    text-transform: none !important;
    letter-spacing: normal !important;
    font-size: 14px !important;
}

/* Override any inline/legacy button color set by JS */
#genBtn.next-button:not([disabled]) {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 34px;
    border-radius: 6px;
    background: var(--skriv-teal) !important;
    background-image: none !important;
    color: #fff !important;
}

#genBtn.next-button:not([disabled]):hover {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 34px;
    border-radius: 6px;
    background: var(--skriv-teal-hover) !important;
}

/* Copy / tick animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.fade-in {
    animation: fadeIn 0.5s forwards;
}

.fade-out {
    animation: fadeOut 0.5s forwards;
}

.tick-btn {
    display: none;
}

/* Content / editable */
#text-section textarea.content {
    box-sizing: border-box;
    width: 100%;
    outline: none;
    resize: none;
    overflow: hidden;
}

.content {
    min-height: auto;
}

.hidden {
    display: none;
}

/* Loader */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
}

.paragraph-wrapper {
    position: relative;
    min-height: 80px;

}

.skeleton-loader {
    width: 100%;
    height: 100%;
    background: #ddd;
    overflow: hidden;
    position: relative;
}

.skeleton-loader::before {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -150%;
    }

    50% {
        left: 100%;
    }

    100% {
        left: 150%;
    }
}

/* Edit controls */
.edit-controls {
    margin-bottom: 10px;
}

.save-btn,
.cancel-btn {
    padding: 5px 10px;
    margin-right: 5px;
    cursor: pointer;
    border-radius: 4px;
}

.save-btn {
    background: #4CAF50;
    color: white;
    border: none;
}

.cancel-btn {
    background: #ccc;
    color: #333;
    border: none;
}

/* Mic listening state */
.listening {
    fill: rgb(12, 255, 12);
}

#stopIcon {
    display: none;
}

/* Legacy selectors (keep for JS / minimal impact) */
#subTitle {
    margin: 0;
}

#title {
    width: 100%;
    text-align: center;
    margin: 8vh 0 2vh 0;
}

.errorP {
    color: red !important;
    display: none;
    font-weight: 500 !important;
    margin-top: 10px;
}

/* ===== Quill Editor Styles ===== */

/* Hide all Quill toolbars */
#cv-textarea-quill .ql-toolbar.ql-snow,
#paragraph1CV .ql-toolbar.ql-snow,
#text-section .ql-toolbar.ql-snow {
    display: none !important;
}

/* ---- Body input Quill editor ---- */
#cv-textarea-quill .ql-container.ql-snow {
    border: none;
    font-family: inherit;
    font-size: inherit;
    height: 100% !important;
}

#cv-textarea-quill .ql-editor {
    padding: 0;
    min-height: 100%;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: #555555;
    background-color: #FFFFFF;
}

/* Force pasted code blocks (VS Code / ChatGPT / etc.) to drop their own
   colors and backgrounds. The clipboard matcher strips these on paste, but
   this is a CSS safety net for any inline styles that slip through. */
#cv-textarea-quill .ql-editor * {
    color: #555555 !important;
    background: transparent !important;
    background-color: transparent !important;
    font-size: 14px !important;
    text-align: left !important;
}

#cv-textarea-quill .ql-editor.ql-blank::before {
    color: rgba(0, 0, 0, 0.4);
    font-style: normal;
    left: 12px;
    right: 12px;
    /* white-space: pre-line; */
}

/* ---- Response Quill editor ---- */
#paragraph1CV .ql-container.ql-snow {
    border: none;
    font-family: inherit;
    font-size: inherit;
    height: auto !important;
}

#paragraph1CV .ql-editor {
    padding: 0;
    min-height: 60px;
    height: auto;
    overflow-y: visible;
    font-size: 14px;
    line-height: 1.6;
    color: #555555;
}

#paragraph1CV .ql-editor * {
    color: #555555 !important;
}

#paragraph1CV .ql-editor.ql-blank::before {
    color: rgba(0, 0, 0, 0.4);
    font-style: normal;
    left: 0;
    right: 0;
}

/* List spacing in Quill */
#paragraph1CV .ql-editor ol,
#paragraph1CV .ql-editor ul {
    margin: 4px 0;
    padding-left: 1.5em;
}

/* Headings in response */
#paragraph1CV .ql-editor h1,
#paragraph1CV .ql-editor h2,
#paragraph1CV .ql-editor h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 8px 0 4px;
}

/* Paragraphs */
#paragraph1CV .ql-editor p {
    margin: 4px 0;
}

/* ==========================================================================
   Mobile layout fixes for .skriv-card-icon-button-wrap and .skriv-control-panel
   ========================================================================== */
@media (max-width: 767px) {
    .skriv-card-icon-button-wrap {
        flex-wrap: wrap;
        row-gap: 10px;
        column-gap: 12px;
        justify-content: space-between;
        align-items: center;
    }

    .skriv-card-icons {
        order: 1;
        flex: 0 0 auto;
    }

    .skriv-submit-btn {
        order: 2;
        flex: 0 0 auto;
    }

    .skriv-control-label {
        order: 3;
        flex: 1 1 100%;
        text-align: center;
        font-size: 13px;
    }

    .skriv-control-panel {
        padding: 0 2px;
    }

    .skriv-slider-wrap {
        width: 100%;
        margin-top: -31px;
    }

    .skriv-slider-label-wrap {
        gap: 8px;
    }

    .skriv-slider-label {
        font-size: 12px;
        white-space: nowrap;
    }

    /* Neutralize the inline left-margin on the middle slider label */
    .skriv-slider-label-wrap .skriv-slider-label[style*="margin-left"] {
        margin-left: 0 !important;
    }
}