/* Reset & Base */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            line-height: 1.6;
            color: #1a1a1a;
            background-color: #f9f9f9;
        }

        /* Header */
        header {
            background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
            color: white;
            padding: 2rem 1rem;
            text-align: center;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        header h1 {
            font-size: 2rem;
            margin-bottom: 0.5rem;
            font-weight: 700;
        }

        header p {
            font-size: 1.1rem;
            opacity: 0.95;
        }

        /* Main Container */
        main {
            max-width: 1200px;
            margin: 2rem auto;
            padding: 0 1rem;
        }

        /* Advanced Toggle */
        .advanced-toggle {
            background: #eef4ff;
            border: 1px solid #d6e4ff;
            padding: 1rem 1.25rem;
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
            margin-bottom: 1.5rem;
        }

        .advanced-toggle label {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            font-weight: 600;
            color: #0b3a82;
        }

        .advanced-toggle input[type="checkbox"] {
            width: 16px;
            height: 16px;
            cursor: pointer;
            accent-color: #6f8fbf;
        }

        /* Muted checkboxes for toggle-style inputs */
        .advanced-toggle input[type="checkbox"],
        #favorites-toggle input[type="checkbox"],
        .export-settings input[type="checkbox"],
        #missing-info,
        #export-missing-info {
            width: 16px;
            height: 16px;
            accent-color: #6f8fbf;
        }

        .advanced-toggle .helper {
            font-size: 0.92rem;
            color: #36507a;
        }

        /* Favorites Menu */
        .favorites-menu {
            background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
            border-radius: 8px;
            padding: 1.5rem;
            margin-bottom: 2rem;
            box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
        }

        .favorites-menu.hidden {
            display: none;
        }

        .favorites-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            flex-wrap: wrap;
            gap: 1rem;
        }

        .favorites-header h2 {
            font-size: 1.3rem;
            color: #1a1a1a;
            margin: 0;
        }

        .clear-favorites-btn {
            background-color: #dc3545;
            color: white;
            border: none;
            padding: 0.5rem 1rem;
            font-size: 0.9rem;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s ease;
            font-weight: 500;
        }

        .clear-favorites-btn:hover {
            background-color: #c82333;
        }

        .favorites-list {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
        }

        .favorite-chip {
            background-color: white;
            padding: 0.5rem 1rem;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            font-size: 0.95rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .favorite-chip:hover {
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
            transform: translateY(-1px);
        }

        /* Info Button */
        .info-btn {
            background: none;
            border: none;
            font-size: 0.85rem;
            cursor: pointer;
            color: #0066cc;
            padding: 0;
            transition: color 0.2s ease;
            text-decoration: none;
            display: inline-block;
            margin-top: 0.5rem;
        }

        .info-btn:hover {
            color: #0052a3;
            text-decoration: underline;
        }

        /* Modal Overlay */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.7);
            z-index: 1000;
            justify-content: center;
            align-items: center;
            padding: 1rem;
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal-content {
            background: white;
            border-radius: 8px;
            max-width: 800px;
            width: 100%;
            max-height: 80vh;
            display: flex;
            flex-direction: column;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
            position: relative;
        }

        .modal-header {
            padding: 1.5rem;
            border-bottom: 2px solid #e0e0e0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .modal-header h3 {
            margin: 0;
            color: #0066cc;
            font-size: 1.3rem;
        }

        .modal-close {
            background: none;
            border: none;
            font-size: 1.8rem;
            cursor: pointer;
            color: #666;
            padding: 0;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 4px;
            transition: background-color 0.3s ease;
        }

        .modal-close:hover {
            background-color: #f0f0f0;
            color: #1a1a1a;
        }

        .modal-body {
            padding: 1.5rem;
            overflow-y: auto;
            flex-grow: 1;
        }

        .modal-body pre {
            white-space: pre-wrap;
            word-wrap: break-word;
            background-color: #f9f9f9;
            padding: 1rem;
            border-radius: 4px;
            border-left: 4px solid #0066cc;
            font-family: 'Courier New', monospace;
            font-size: 0.9rem;
            line-height: 1.6;
            color: #1a1a1a;
            margin: 0;
        }

        @media (max-width: 768px) {
            .modal-content {
                max-height: 90vh;
            }

            .modal-header {
                padding: 1rem;
            }

            .modal-body {
                padding: 1rem;
            }
        }

        /* Export settings in modal */
        #export-modal .settings-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 1.1rem;
            margin-top: 1rem;
            background: #f6f8ff;
            border: 1px solid #dbe7ff;
            border-radius: 10px;
            padding: 1rem;
        }

        #export-modal .field {
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
        }

        #export-modal label {
            font-weight: 600;
            color: #0b3a82;
            font-size: 0.95rem;
        }

        #export-modal select,
        #export-modal input[type="checkbox"] {
            width: 100%;
            padding: 0.65rem 0.7rem;
            border: 1px solid #c8d8ff;
            border-radius: 8px;
            background: linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
            color: #1a1a1a;
            box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
        }

        #export-modal select:focus,
        #export-modal input[type="checkbox"]:focus {
            outline: 2px solid #7da6ff;
            outline-offset: 1px;
            border-color: #7da6ff;
        }

        #export-modal input[type="checkbox"] {
            width: auto;
            margin-right: 0.4rem;
        }

        /* Prompt Cards Grid */
        .prompt-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 1.5rem;
            margin-bottom: 2rem;
        }

        .prompt-grid.loading {
            opacity: 0.6;
            pointer-events: none;
        }

        .prompt-card {
            background: white;
            border-radius: 8px;
            padding: 1.5rem;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
            transition: box-shadow 0.3s ease, transform 0.3s ease;
            display: flex;
            flex-direction: column;
        }

        .prompt-card:hover {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            transform: translateY(-2px);
        }

        .prompt-card h3 {
            font-size: 1.2rem;
            margin-bottom: 0.5rem;
            color: #0066cc;
        }

        .prompt-card p {
            font-size: 0.95rem;
            color: #666;
            margin-bottom: 1rem;
            flex-grow: 1;
        }

        .loading-message {
            text-align: center;
            color: #666;
            padding: 2rem;
            font-size: 1.1rem;
            grid-column: 1 / -1;
        }

        .error-message {
            background-color: #fee;
            border: 1px solid #fcc;
            border-radius: 4px;
            padding: 1rem;
            color: #c33;
            margin: 1rem 0;
            grid-column: 1 / -1;
        }

        /* Security Note (Compact) */
        .security-note {
            font-size: 0.9rem;
            color: #666;
            margin-bottom: 1rem;
            padding-bottom: 0.5rem;
            border-bottom: 1px solid #e0e0e0;
        }

        .security-note-text {
            margin-bottom: 0.5rem;
        }

        .security-note-link {
            color: #0066cc;
            text-decoration: none;
            cursor: pointer;
            font-weight: 500;
            margin-left: 0.3rem;
        }

        .security-note-link:hover {
            text-decoration: underline;
        }

        /* Expandable Examples */
        .security-examples {
            display: none;
            background-color: #f9f9f9;
            border-left: 3px solid #ffc107;
            padding: 0.75rem;
            margin: 0.5rem 0 1rem 0;
            border-radius: 4px;
            font-size: 0.85rem;
        }

        .security-examples.active {
            display: block;
        }

        .security-examples strong {
            display: block;
            color: #856404;
            margin-bottom: 0.3rem;
        }

        .security-examples ul {
            margin-left: 1.5rem;
            color: #666;
            padding-left: 1.2em;
            word-break: break-word;
            white-space: normal;
            max-width: 95%;
            box-sizing: border-box;
        }
        .security-examples li {
            margin-bottom: 0.2rem;
            word-break: break-word;
            white-space: normal;
        }

        .security-examples li {
            margin-bottom: 0.2rem;
        }

        /* Favorite Button */
        .favorite-btn {
            position: absolute;
            top: 1rem;
            right: 1rem;
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            transition: transform 0.2s ease;
            padding: 0.25rem;
            line-height: 1;
        }

        .favorite-btn:hover {
            transform: scale(1.2);
        }

        .favorite-btn.active {
            color: #ffc107;
        }

        .prompt-card {
            position: relative;
        }

        /* Action Buttons */
        .actions {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .card-actions {
            gap: 0.55rem;
        }

        .copy-btn-primary {
            order: 1;
        }

        .local-chat-btn {
            order: 2;
        }

        .direct-chat-btn {
            order: 3;
            background-color: #f2f4f7;
            color: #667085;
            border-color: #d0d5dd;
            cursor: not-allowed;
        }

        .direct-chat-btn:disabled {
            opacity: 0.95;
        }

        .primary-btn {
            background-color: #0052a3;
            color: white;
            border: none;
            padding: 0.75rem 1.5rem;
            font-size: 1rem;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s ease;
            font-weight: 700;
            width: 100%;
            text-align: center;
        }

        .primary-btn:hover:not(:disabled) {
            background-color: #003d7a;
        }

        .secondary-btn {
            background-color: #ffffff;
            color: #0052a3;
            border: 1px solid #c7d7f5;
            padding: 0.75rem 1.5rem;
            font-size: 1rem;
            border-radius: 4px;
            cursor: pointer;
            transition: border-color 0.3s ease, color 0.3s ease;
            font-weight: 600;
            width: 100%;
            text-align: center;
        }

        .secondary-btn:hover:not(:disabled) {
            border-color: #0052a3;
            color: #003d7a;
        }

        .secondary-btn.with-text {
            /* No color change, only keep font-weight if needed */
            font-weight: 600;
        }

        .secondary-btn:active,
        .primary-btn:active,
        .copy-btn:active {
            transform: scale(0.98);
        }

        .copy-btn {
            background-color: #0052a3;
            color: white;
            border: none;
            padding: 0.75rem 1.5rem;
            font-size: 1rem;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s ease;
            font-weight: 700;
            width: 100%;
            text-align: center;
        }

        .copy-btn:hover:not(:disabled) {
            background-color: #003d7a;
        }

        .copy-btn:active {
            transform: scale(0.98);
        }

        .copy-btn.copied {
            background-color: #28a745;
        }

        .advanced-only {
            display: none;
        }

        body.advanced-mode-on .advanced-only {
            display: block;
        }

        .favorites-only {
            display: none;
        }

        body.favorites-mode-on .favorites-only {
            display: block;
        }

        /* Hide export settings unless advanced mode is enabled */
        .export-settings {
            display: none;
        }

        body.advanced-mode-on .export-settings {
            display: block;
        }

        /* Hidden prompt textareas; export preview textarea visible */
        .prompt-card textarea {
            display: none;
        }

        #export-textarea {
            display: block;
            width: 100%;
            min-height: 220px;
            margin-top: 0.75rem;
            padding: 0.75rem 0.9rem;
            border: 1px solid #dbe7ff;
            border-radius: 8px;
            background: #fff;
            font-family: 'Courier New', monospace;
            font-size: 0.95rem;
            line-height: 1.5;
            color: #1a1a1a;
            resize: vertical;
        }

        /* Footer */
        footer {
            background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
            color: #ffffff;
            text-align: center;
            padding: 1.5rem 1rem;
            margin-top: 3rem;
            font-size: 0.9rem;
        }

        footer a {
            color: #ffffff;
            text-decoration: underline;
            font-weight: 500;
        }

        footer a:hover {
            opacity: 0.85;
        }

        /* Ljus informationsruta i footern */
        .footer-info {
            margin-bottom: 1rem;
            padding: 1rem;
            background: #e8f4f8;
            border-radius: 4px;
            border-left: 4px solid #0066cc;
            color: #1a1a1a;
        }

        /* Text i info-rutan */
        .footer-info strong {
            color: #003d7a;
        }

        /* Länkar i info-rutan (mörk text på ljus bakgrund) */
        .footer-info a {
            color: #003d7a;
            text-decoration: underline;
            font-weight: 600;
        }

        .footer-info a:hover {
            color: #002a55;
        }

        /* Viktigt-sektion länkar */
        footer .important-links a {
            color: #ffcc00;
            text-decoration: underline;
            font-weight: 600;
        }

        footer .important-links a:hover {
            color: #ffaa00;
        }

        /* Footer: Viktigt-sektion */
        .footer-warning-links a {
            color: #003d7a; /* Dark blue for better contrast */
            text-decoration: underline;
            font-weight: 600;
        }

        .footer-warning-links a:hover {
            color: #002a55; /* Slightly darker blue on hover */
        }

        /* Responsive */
        @media (max-width: 768px) {
            header h1 {
                font-size: 1.5rem;
            }

            header p {
                font-size: 1rem;
            }

            .prompt-grid {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 480px) {
            main {
                margin: 1rem auto;
            }

            .prompt-card {
                padding: 1rem;
            }

            header {
                padding: 1.5rem 1rem;
            }
        }

        /* Quick Input Container */
        .quick-input-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 1rem;
            background: linear-gradient(135deg, #e3f2fd 0%, #f5f5f5 100%);
            border-radius: 8px;
            margin-bottom: 1.5rem;
        }

        .quick-input-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.75rem;
        }

        .quick-input-header h3 {
            font-size: 1.1rem;
            color: #0b3a82;
            margin: 0;
        }

        .quick-input-clear-btn {
            background: #f5f5f5;
            border: 1px solid #ddd;
            padding: 0.4rem 0.8rem;
            font-size: 0.85rem;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.3s ease;
            color: #666;
        }

        .quick-input-clear-btn:hover {
            background: #e0e0e0;
            border-color: #bbb;
        }

        .quick-input-textarea {
            width: 100%;
            min-height: 120px;
            padding: 0.75rem;
            border: 2px solid #d6e4ff;
            border-radius: 6px;
            font-family: inherit;
            font-size: 0.95rem;
            line-height: 1.5;
            resize: vertical;
            transition: border-color 0.3s ease;
        }

        .quick-input-textarea:focus {
            outline: none;
            border-color: #0066cc;
        }

        .quick-input-textarea::placeholder {
            color: #999;
        }

        @media (max-width: 768px) {
            .quick-input-container {
                padding: 0.75rem;
            }

            .quick-input-textarea {
                min-height: 100px;
                font-size: 0.9rem;
            }
        }

        /* Settings Container */
        /* Why: Separate container outside <main> prevents settings menu from interfering 
           with prompt card layout. Flexbox ensures right-alignment across all screen sizes. */
        .settings-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 1rem 1rem 0 1rem;
            display: flex;
            justify-content: flex-end;
        }

        /* Settings Menu */
        .settings-menu {
            position: relative;
            z-index: 1001;
        }

        .settings-gear {
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            padding: 0.5rem;
            transition: transform 0.3s ease;
        }

        .settings-gear:hover {
            transform: rotate(20deg);
        }

        .settings-dropdown {
            /* Why: Absolute positioning relative to .settings-menu (parent) allows dropdown 
               to overlay content without affecting document flow. right: 0 keeps alignment 
               consistent with gear icon. max-width prevents mobile viewport overflow. */
            position: absolute;
            top: 2.5rem;
            right: 0;
            background: white;
            border: 1px solid #dbe7ff;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            padding: 1rem;
            z-index: 1000;
            min-width: 250px;
            max-width: 90vw;
        }

        .settings-option {
            padding: 0.75rem 0;
            border-bottom: 1px solid #f0f0f0;
        }

        .settings-option:last-child {
            border-bottom: none;
        }

        .settings-dropdown label {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.9rem;
            color: #0b3a82;
            font-weight: 500;
            margin: 0;
            cursor: pointer;
        }


        .settings-link {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            font-size: 0.9rem;
            color: #0b3a82;
            font-weight: 500;
            text-decoration: none;
        }

.settings-link:hover {
    text-decoration: underline;
}

.settings-link-disabled {
    color: #97a3b6;
    cursor: not-allowed;
    text-decoration: none;
    pointer-events: none;
}

        .settings-dropdown input[type="checkbox"] {
            width: 18px;
            height: 18px;
            cursor: pointer;
            accent-color: #6f8fbf;
        }

        .settings-helper {
            font-size: 0.85rem;
            color: #666;
            margin: 0.35rem 0 0 1.75rem;
        }

        .settings-dropdown.hidden {
            display: none;
        }

        @media (max-width: 768px) {
            /* Why: Mobile devices need tighter constraints. calc(100vw - 2rem) ensures 
               dropdown never causes horizontal scroll. Reduced min-width (200px) 
               accommodates narrower screens while maintaining readability. */
            .settings-dropdown {
                right: 0;
                min-width: 200px;
                max-width: calc(100vw - 2rem);
            }
        }

.example-btn {
    background-color: #0052a3 !important;
    color: #fff !important;
    border: none;
    padding: 0.18rem 0.8rem;
    font-size: 0.85em;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: 700;
    text-align: center;
    display: inline-block;
    margin-left: 0.5em;
    line-height: 1.1;
    box-shadow: none;
}

.example-btn:hover,
.example-btn:focus {
    background-color: #003d7a !important;
    color: #fff !important;
}

.btn-small {
    font-size: 0.5em;
    padding: 0.2em 0.6em;
    margin-left: 0.5em;
    vertical-align: middle;
}

.quick-input-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
    font-size: 0.97rem;
    color: #555;
}

.quick-input-helper-row {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-input-lock-icon {
    font-size: 1.2em;
}

.quick-input-file-row {
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.quick-input-file-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-height: 42px;
    padding: 0.65rem 1rem;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    background: #ffffff;
    color: #0052a3;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.quick-input-file-label:hover {
    background: #f8fbff;
    border-color: #b8c9e0;
}

.quick-input-file-label:focus-within {
    box-shadow: 0 0 0 3px rgba(31, 95, 191, 0.12);
    border-color: #1f5fbf;
}

#quick-input-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.quick-input-file-help {
    font-size: 0.8rem;
    color: #666;
}

#anon-examples-modal {
    display: none;
    background: #fff;
    border: 1px solid #bbb;
    border-radius: 6px;
    box-shadow: 0 2px 8px #0002;
    padding: 1rem;
    margin-top: 0.5rem;
    max-width: 420px;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-break: break-word;
}

#anon-examples-modal ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding-left: 1.25rem;
    margin-left: 0;
}

#anon-examples-modal li {
    margin-left: 0;
}

.anon-examples-close {
    margin-top: 0.5rem;
}

.export-tips-row {
    font-size: 0.97rem;
    color: #36507a;
    margin-bottom: 0.5rem;
}

.export-quickinput-info {
    font-size: 0.97rem;
    color: #555;
    margin-bottom: 0.5rem;
    display: none;
}

.is-hidden {
    display: none;
}

.export-role-custom {
    display: none;
    margin-top: 0.5rem;
}

.export-role-gdpr {
    display: none;
    font-size: 0.93rem;
    color: #b85c00;
    margin-top: 0.25rem;
}

.footer-warning {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #e8f4f8;
    border-radius: 4px;
    border-left: 4px solid #0066cc;
}

.footer-warning-title {
    color: #0066cc;
}

.footer-warning-text {
    margin-top: 0.5rem;
    color: #0066cc;
    font-size: 0.95rem;
}

.footer-warning-links {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.spacer-min-height {
    min-height: 1.5em;
}

.admin-panel {
    margin: 1rem auto;
    padding: 1rem;
    max-width: 1000px;
    border: 1px solid #d5d5d5;
    border-radius: 10px;
    background: #fafafa;
}

.admin-helper {
    color: #444;
    margin-bottom: 0.75rem;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.admin-grid input[type="text"],
.admin-grid input[type="password"] {
    width: 100%;
    padding: 0.55rem;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.admin-provider-list {
    background: #fff;
    border: 1px solid #e5e5e5;
    padding: 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}
