@font-face {
    font-family: 'GT Ultra';
    src: url('fonts/GTUltra-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}
@font-face {
    font-family: 'GT Ultra';
    src: url('fonts/GTUltra-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --primary-accent: #0158A3;
    --text-primary: #191919;
    --text-secondary: #787774;
    --text-tertiary: #9b9b9b;
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f5;
    --bg-hover: #f0f0ee;
    --border-light: #e8e8e6;
    --border-medium: #d0d0ce;
    --success: #16955A;
    --error: #eb5757;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 {
    font-family: 'GT Ultra', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 48px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-align: center;
    margin: 60px 0 16px 0;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 18px;
    margin-bottom: 48px;
    font-weight: 400;
}

h2 {
    font-family: 'GT Ultra', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 20px 0;
    padding: 0;
}

.header-section {
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-primary);
    margin-bottom: 40px;
}

/* Layout Grid (immer 2 Spalten) */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px 80px 40px;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 60px;
}

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
        padding: 0 24px 60px 24px;
        gap: 40px;
    }
}

.form-section { background: transparent; font-family: 'GT Ultra', sans-serif; }
.form-section input, .form-section textarea, .form-section button { font-family: inherit; }
.form-section h2, .form-section label { font-weight: 700; }

.section-group { margin-bottom: 32px; }
.form-field { margin-bottom: 24px; }

label {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.field-hint {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 6px;
    line-height: 1.5;
}

input[type="text"], input[type="url"], textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.15s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(1, 88, 163, 0.1);
}

textarea { resize: vertical; min-height: 72px; line-height: 1.5; }

.url-input-wrapper { position: relative; }
.url-input-wrapper input { padding-right: 40px; }

.url-status {
    font-size: 13px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.url-status.valid { color: var(--success); }
.url-status.invalid { color: var(--error); }

.character-counter-wrapper { position: relative; }
.character-counter {
    position: absolute; right: 12px; bottom: 12px;
    font-size: 12px; color: var(--text-tertiary);
    background: var(--bg-primary); padding: 0 4px;
    z-index: 5;
}

.textarea-wrapper { position: relative; }

.insert-url-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 12px;
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--border-medium);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--primary-accent);
    transition: all 0.2s;
    z-index: 5;
}
.character-counter-wrapper .insert-url-btn { right: 80px; }
.insert-url-btn:hover { background: var(--bg-hover); color: #003060; }

/* ===== Mode Tabs ===== */
.mode-tabs {
    display: flex; gap: 0; margin-bottom: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 4px; border: 1px solid var(--border-light);
}

.mode-tab {
    flex: 1; padding: 10px; border: none; background: transparent;
    cursor: pointer; font-weight: 500; color: var(--text-secondary);
    border-radius: var(--radius-sm); transition: all 0.2s ease;
}
.mode-tab.active { background: white; color: var(--primary-accent); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: all 0.15s ease; gap: 8px;
}
.btn-primary { background: var(--text-primary); color: white; }
.btn-primary:hover { background: #000; transform: translateY(-1px); }
.btn-secondary { background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border-medium); }
.btn-secondary:hover { background: var(--bg-secondary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

#generateButton { width: 100%; margin-top: 8px; padding: 12px 20px; font-size: 15px; }
#generateButton .btn-icon { display: none; font-size: 1.2em; font-weight: bold; }
#generateButton.is-success {
    background-color: var(--success) !important; border-color: var(--success) !important;
    color: white !important; cursor: default;
}
#generateButton.is-success .btn-text { display: none; }
#generateButton.is-success .btn-icon { display: inline-block; }

@keyframes successPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.animate-pop { animation: successPop 0.3s ease-in-out; }

/* ===== Output Section ===== */
#outputSection { margin-top: 40px; padding-top: 40px; border-top: 1px solid var(--border-light); }
.output-grid { display: grid; gap: 8px; }
.share-link-item {
    display: flex; align-items: center; padding: 16px;
    background: var(--bg-primary); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); transition: all 0.15s ease; gap: 16px;
}
.share-link-item:hover { background: var(--bg-secondary); border-color: var(--border-medium); }
.platform-label { font-size: 14px; font-weight: 500; color: var(--text-primary); min-width: 100px; }
.link-actions { margin-left: auto; display: flex; gap: 8px; }

.share-button, .copy-button {
    padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}
.share-button { background: var(--primary-accent); color: white; text-decoration: none; border: none; display: inline-block; font-weight: 500; }
.share-button:hover { background: #014a8c; transform: translateY(-1px); }
.copy-button { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-light); font-weight: 400; }
.copy-button:hover { color: var(--text-primary); border-color: var(--border-medium); background: var(--bg-secondary); }
.copy-button:disabled { background: var(--success); color: white; border-color: var(--success); }

.share-button.disabled, .copy-button:disabled {
    background-color: #e0e0e0; color: #a0a0a0; cursor: not-allowed;
    pointer-events: auto; border-color: #d0d0d0; text-decoration: none; transform: none !important;
}

/* Tooltips */
.share-button[data-tooltip], .copy-button[data-tooltip] { position: relative; }
.share-button[data-tooltip]:hover::after, .copy-button[data-tooltip]:hover::after {
    content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%;
    transform: translateX(-50%); background-color: #333; color: white;
    padding: 6px 10px; border-radius: 4px; font-size: 12px; white-space: nowrap;
    z-index: 100; margin-bottom: 8px; pointer-events: none;
}
.share-button[data-tooltip]:hover::before, .copy-button[data-tooltip]:hover::before {
    content: ''; position: absolute; bottom: 100%; left: 50%;
    transform: translateX(-50%); border-width: 5px; border-style: solid;
    border-color: #333 transparent transparent transparent; margin-bottom: -2px; z-index: 100;
}

/* ===== Preview Section ===== */
.preview-container { position: sticky; top: 24px; }
.preview-card {
    background: var(--bg-secondary); border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); overflow: hidden;
}
.preview-header { padding: 20px 24px; border-bottom: 1px solid var(--border-light); background: var(--bg-primary); }
#previews { padding: 24px; min-height: 300px; background: var(--bg-primary); }

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-tertiary);
    padding: 48px 24px;
}

/* HIER WURDE DIE ÄNDERUNG VORGENOMMEN */
.preview-placeholder-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.preview-loading, .preview-error { text-align: center; padding: 48px 24px; }
.preview-loading { color: var(--text-secondary); }
.preview-error { color: var(--error); }

.preview-tabs { display: flex; gap: 4px; margin-bottom: 20px; padding: 0 0 12px 0; border-bottom: 1px solid var(--border-light); }
.tab-btn {
    padding: 6px 12px; background: transparent; border: none;
    color: var(--text-tertiary); font-size: 14px; font-weight: 400;
    cursor: pointer; border-radius: var(--radius-sm); transition: all 0.15s ease; position: relative;
}
.tab-btn:hover { color: var(--text-secondary); background: var(--bg-secondary); }
.tab-btn.active { color: var(--text-primary); font-weight: 500; }
.tab-btn.active::after {
    content: ''; position: absolute; bottom: -13px; left: 12px; right: 12px; height: 2px; background: var(--text-primary);
}

/* Preview Content */
.preview { font-size: 14px; line-height: 1.5; }
.whatsapp-preview { background: #e5ddd5; padding: 16px; border-radius: var(--radius-md); }
.twitter-preview { background: white; padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--border-light); }
.mail-preview { background: white; padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--border-light); }

.wa-header { background: #075e54; color: white; padding: 8px; text-align: center; border-radius: var(--radius-sm) var(--radius-sm) 0 0; margin: -16px -16px 16px -16px; font-size: 13px; font-weight: 500; }
.wa-message-container { display: flex; justify-content: flex-end; }
.wa-message-bubble { background: #dcf8c6; border-radius: var(--radius-sm); padding: 12px; max-width: 85%; position: relative; }
.wa-message-bubble::after { content: ""; position: absolute; right: -4px; bottom: 8px; width: 0; height: 0; border-style: solid; border-width: 4px 0 4px 6px; border-color: transparent transparent transparent #dcf8c6; }

.twitter-header { display: flex; align-items: center; margin-bottom: 12px; gap: 12px; }
.twitter-avatar { width: 40px; height: 40px; background: linear-gradient(135deg, #e0e0e0, #c0c0c0); border-radius: 50%; flex-shrink: 0; }
.twitter-user { display: flex; flex-direction: column; }
.twitter-username { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.twitter-handle { color: var(--text-tertiary); font-size: 13px; }
.twitter-content { margin-left: 52px; }
.twitter-actions { display: flex; gap: 40px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.twitter-action { font-size: 16px; opacity: 0.6; cursor: pointer; transition: opacity 0.15s ease; }
.twitter-action:hover { opacity: 1; }

.mail-header { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-light); }
.mail-to, .mail-subject { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.mail-to strong, .mail-subject strong { color: var(--text-primary); font-weight: 500; }
.mail-body { color: var(--text-primary); }

.preview-text { white-space: pre-wrap; word-wrap: break-word; margin-bottom: 8px; color: var(--text-primary); }
.preview-url { color: var(--primary-accent); word-break: break-all; font-size: 13px; margin-bottom: 8px; }
.wa-time { font-size: 11px; color: #667781; text-align: right; margin-top: 4px; }

.preview-og-card { margin-top: 12px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); overflow: hidden; background: white; }
.wa-og-card { margin-top: 8px; }
.twitter-og-card { margin-top: 12px; border-radius: 12px; }
.mail-og-card { margin-top: 16px; }
.preview-og-card img { width: 100%; max-height: 160px; object-fit: cover; display: block; }
.twitter-og-card img { max-height: 200px; }
.preview-og-content { padding: 12px; }
.preview-og-title { font-weight: 500; margin-bottom: 4px; font-size: 14px; color: var(--text-primary); line-height: 1.3; }
.preview-og-description { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.preview-og-site { font-size: 12px; color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; }
.twitter-og-card .preview-og-site { margin-bottom: 4px; }

/* Promo Section */
.gemini-promo { display: flex; align-items: center; gap: 20px; padding: 20px 24px; margin-top: 32px; background: linear-gradient(135deg, #f8fafb 0%, #f0f4f8 100%); border: 1px solid var(--border-light); border-radius: var(--radius-lg); position: relative; }
.promo-icon svg { width: 32px; height: 32px; opacity: 0.7; }
.promo-text { flex: 1; }
.promo-text p { margin: 0; font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.promo-action-link { padding: 8px 16px; background: var(--primary-accent); color: white; text-decoration: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; transition: all 0.15s ease; }
.promo-action-link:hover { background: #014a8c; transform: translateY(-1px); }
.close-promo-button { position: absolute; top: 12px; right: 12px; background: transparent; border: none; font-size: 20px; color: var(--text-tertiary); cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); transition: all 0.15s ease; }
.close-promo-button:hover { background: var(--bg-hover); color: var(--text-primary); }

hr { margin: 32px 0; border: 0; border-top: 1px solid var(--border-light); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border: 3px solid var(--bg-primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

.preview {
    font-size: 14px;
    line-height: 1.5;
    position: relative; /* Wichtig für Overlay */
    transition: all 0.3s ease;
}

/* Limit überschritten */
.preview.limit-exceeded {
    opacity: 0.5; /* Ausgegraut */
    border: 2px solid var(--error) !important; /* Roter Rand */
    pointer-events: none; /* Keine Interaktion */
}

/* Warnhinweis Overlay */
.preview.limit-exceeded::after {
    content: "Text ist zu lang!";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--error);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10;
    white-space: nowrap;
}

/* Spezifische Anpassungen, damit der rote Rand gut sichtbar ist */
.whatsapp-preview.limit-exceeded {
    border: 2px solid var(--error); /* WhatsApp Preview hat normal keinen Rand */
}

/* Basis-Stil für erkannte Links im Text */
.preview-link {
    font-weight: normal;
    word-break: break-all; /* Lange Links umbrechen */
    cursor: pointer;
}

/* WhatsApp: Helles Blau, oft unterstrichen */
.whatsapp-preview .preview-link {
    color: #039be5;
    text-decoration: underline;
}

/* Twitter: Twitter-Blau, meist ohne Unterstrich (bis Hover) */
.twitter-preview .preview-link {
    color: #1d9bf0;
    text-decoration: none;
}
.twitter-preview .preview-link:hover {
    text-decoration: underline;
}

/* Mail: Klassisches Link-Blau, unterstrichen */
.mail-preview .preview-link {
    color: #007aff;
    text-decoration: underline;
}

/* ===== Support Widget (CI Adapted) ===== */
.support-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    /* Erbt nun die Schriftart der Seite (GT Ultra / System) */
    font-family: 'GT Ultra', sans-serif; 
}

/* Der Toggle Button */
.support-toggle {
    background-color: var(--primary-accent); /* Dein Blau (#0158A3) */
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.support-toggle:hover {
    /* Dunklere Nuance für Hover (manuell angepasst an dein Blau) */
    background-color: #003060; 
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Das Fragezeichen-Icon */
.support-icon {
    background: rgba(255, 255, 255, 0.2);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    /* Hier explizit GT Ultra für das Fragezeichen */
    font-family: 'GT Ultra', sans-serif; 
}

/* Das Menü (Pop-up) */
.support-menu {
    background: var(--bg-primary); /* Weiss */
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); /* 12px Abrundung wie Cards */
    padding: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    min-width: 240px;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom right;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Aktiver Zustand */
.support-widget.is-open .support-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Menü-Einträge */
.support-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: var(--radius-md); /* 8px Abrundung */
    transition: background 0.15s ease;
    font-size: 14px;
    font-weight: 500;
}

.support-item:hover {
    background-color: var(--bg-secondary); /* Dein helles Grau */
    color: var(--primary-accent); /* Text wird Blau beim Hover */
}

.support-item-icon {
    font-size: 18px;
    opacity: 0.9;
}

/* Mobile Anpassung */
@media (max-width: 480px) {
    .support-widget {
        bottom: 20px;
        right: 20px;
    }
    .support-toggle {
        padding: 10px 18px;
        font-size: 14px;
    }
}