/* ============================================================
   SponsorMe Admin — Sport landing-page rich editor
   Everything here is scoped under .sport-editor / .sport-preview*,
   which only App\Forms\Components\SportRichEditor emits. The CMS Pages
   and Email Templates editors (App\Forms\Components\CkEditor) are
   untouched by this file.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,400;0,600;0,700;1,400&family=Barlow+Condensed:wght@500;600;700&display=swap');

.sport-editor {
    --sme-border: #e2e8f0;
    --sme-border-strong: #cbd5e1;
    --sme-chrome: #f8fafc;
    --sme-text: #0f172a;
    --sme-muted: #64748b;
    --sme-primary: #4f46e5;
}

/* ----------------------------------------------------------
   1. ACTION BAR (Preview / Source / Fullscreen)
   ---------------------------------------------------------- */

.sport-editor-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.sport-editor-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    border-radius: 7px;
    border: 1px solid var(--sme-border-strong, #cbd5e1);
    background-color: #fff;
    color: #374151;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
    white-space: nowrap;
}

.sport-editor-btn:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

.sport-editor-btn.is-on {
    background-color: #eef2ff;
    border-color: #6366f1;
    color: #4338ca;
}

.sport-editor-hint {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--sme-muted, #64748b);
}

/* ----------------------------------------------------------
   2. CKEDITOR CHROME — match the surrounding Filament section
   ---------------------------------------------------------- */

.sport-editor .ck.ck-editor {
    border-radius: 10px;
}

/* CKEditor sets its own radii/borders via --ck-* custom properties; overriding
   them here is what actually wins, rather than fighting its selectors. */
.sport-editor .ck.ck-editor,
.sport-editor .ck-body-wrapper {
    --ck-border-radius: 10px;
    --ck-color-base-border: var(--sme-border, #e2e8f0);
    --ck-color-toolbar-border: var(--sme-border, #e2e8f0);
    --ck-color-toolbar-background: var(--sme-chrome, #f8fafc);
    --ck-color-base-background: #fff;
    --ck-color-button-default-hover-background: #e2e8f0;
    --ck-color-button-on-background: #e0e7ff;
    --ck-color-button-on-color: #3730a3;
    --ck-color-focus-border: var(--sme-primary, #4f46e5);
}

.sport-editor .ck.ck-editor__top .ck-toolbar {
    background: var(--sme-chrome, #f8fafc);
    border: 1px solid var(--sme-border, #e2e8f0);
    border-bottom-color: var(--sme-border, #e2e8f0);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 5px 6px;
    row-gap: 3px;
}

/* Toolbar rows created by the '-' break in the items list. */
.sport-editor .ck.ck-toolbar > .ck-toolbar__items {
    flex-wrap: wrap;
    row-gap: 2px;
}

.sport-editor .ck.ck-toolbar .ck-toolbar__line-break {
    flex-basis: 100%;
    height: 0;
}

/* Dropdown labels (Heading, Font size) need room to read as labels. */
.sport-editor .ck.ck-toolbar .ck-dropdown > .ck-button .ck-button__label {
    max-width: none;
    width: auto;
}

/* Toolbar stays reachable while scrolling a long section. */
.sport-editor .ck.ck-editor__top {
    position: sticky;
    top: 0;
    z-index: 5;
}

.sport-editor .ck.ck-toolbar .ck-button {
    border-radius: 6px;
    padding: 5px;
    transition: background-color .12s;
}

.sport-editor .ck.ck-toolbar .ck-button:not(.ck-disabled):hover {
    background-color: #e2e8f0;
}

.sport-editor .ck.ck-toolbar .ck-button.ck-on {
    background-color: #e0e7ff;
    color: #3730a3;
}

.sport-editor .ck.ck-toolbar .ck-toolbar__separator {
    background: var(--sme-border-strong, #cbd5e1);
    margin: 4px 5px;
}

.sport-editor .ck-editor__editable_inline {
    min-height: 420px;
    padding: 18px 20px;
    border: 1px solid var(--sme-border, #e2e8f0) !important;
    border-top: 0 !important;
    border-bottom-left-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    background-color: #fff;
    color: var(--sme-text, #0f172a);
    font-size: 14.5px;
    line-height: 1.7;
}

.sport-editor .ck-editor__editable_inline.ck-focused {
    border-color: var(--sme-primary, #4f46e5) !important;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, .18) !important;
}

/* Readable content typography inside the editable area. */
.sport-editor .ck-content h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .6rem; font-weight: 700; }
.sport-editor .ck-content h2 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 .55rem; font-weight: 700; }
.sport-editor .ck-content h3 { font-size: 1.25rem; line-height: 1.3; margin: 0 0 .5rem; font-weight: 600; }
.sport-editor .ck-content p { margin: 0 0 .85rem; }
.sport-editor .ck-content ul,
.sport-editor .ck-content ol { padding-left: 1.4rem; margin: 0 0 .85rem; }
.sport-editor .ck-content li { margin-bottom: .3rem; }
.sport-editor .ck-content a { color: #4f46e5; text-decoration: underline; }
.sport-editor .ck-content blockquote {
    border-left: 3px solid #cbd5e1;
    margin: 0 0 .85rem;
    padding: .1rem 0 .1rem 1rem;
    font-style: italic;
    color: #475569;
}
.sport-editor .ck-content img { max-width: 100%; height: auto; border-radius: 8px; }
.sport-editor .ck-content table { border-collapse: collapse; }

/* ----------------------------------------------------------
   3. SOURCE VIEW
   ---------------------------------------------------------- */

.sport-editor-source {
    width: 100%;
    min-height: 440px;
    resize: vertical;
    box-sizing: border-box;
    padding: 14px 16px;
    border: 1px solid #334155;
    border-radius: 10px;
    outline: none;
    background-color: #1e1e2e;
    color: #cdd6f4;
    font-family: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.65;
    tab-size: 2;
}

.sport-editor-source:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, .25);
}

/* ----------------------------------------------------------
   4. FULLSCREEN
   ---------------------------------------------------------- */

.sport-editor.is-full {
    position: fixed;
    inset: 0;
    z-index: 60;
    background-color: #fff;
    padding: 16px 20px 20px;
    overflow-y: auto;
}

.sport-editor.is-full .ck-editor__editable_inline {
    min-height: calc(100vh - 170px);
}

.sport-editor.is-full .sport-editor-source {
    min-height: calc(100vh - 170px);
}

/* ----------------------------------------------------------
   5. PREVIEW MODAL
   ---------------------------------------------------------- */

.sport-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: rgba(15, 23, 42, .65);
    backdrop-filter: blur(2px);
}

.sport-preview-dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1100px;
    height: 100%;
    max-height: 90vh;
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.sport-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.sport-preview-title {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.sport-preview-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sport-preview-stage {
    flex: 1;
    overflow-y: auto;
    padding: 40px 24px;
}

.sport-preview-stage.is-dark { background-color: #1A1A1A; }
.sport-preview-stage.is-light { background-color: #F7F3ED; }

/* ----------------------------------------------------------
   6. PUBLIC SPORT-PAGE TYPOGRAPHY
   Plain-CSS transcription of .sport-content / .sport-content-light in
   sponsorme-ui/src/styles/theme.css, so the preview matches the live
   page without needing a Tailwind build on the admin side.
   Tokens: --charcoal #1A1A1A, --gold #C8960C, --cream #F7F3ED.
   ---------------------------------------------------------- */

.sport-preview,
.sport-preview-light {
    max-width: 72rem;
    margin: 0 auto;
    font-family: 'Barlow', sans-serif;
    font-size: 1rem;
}

.sport-preview.is-mobile,
.sport-preview-light.is-mobile {
    max-width: 375px;
}

.sport-preview h1,
.sport-preview h2,
.sport-preview h3,
.sport-preview-light h1,
.sport-preview-light h2,
.sport-preview-light h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
}

/* Dark (charcoal) sections */
.sport-preview h1 { font-size: 3rem; line-height: 1.25; color: #F7F3ED; margin: 0 0 1.5rem; }
.sport-preview h2 { font-size: 2.25rem; line-height: 1.25; color: #F7F3ED; margin: 0 0 1rem; }
.sport-preview h3 { font-size: 1.5rem; line-height: 1.3; color: #F7F3ED; margin: 0 0 .75rem; }
.sport-preview p { color: rgba(247, 243, 237, .8); line-height: 1.625; margin: 0 0 1rem; }
.sport-preview ul,
.sport-preview ol {
    list-style-position: inside;
    list-style-type: disc;
    margin: 0 0 1rem;
    padding-left: 0;
    color: rgba(247, 243, 237, .8);
}
.sport-preview ol { list-style-type: decimal; }
.sport-preview li { margin-bottom: .5rem; }
.sport-preview a { color: #C8960C; text-decoration: none; }
.sport-preview a:hover { text-decoration: underline; }
.sport-preview strong { color: #F7F3ED; font-weight: 600; }
.sport-preview blockquote {
    border-left: 2px solid rgba(200, 150, 12, .4);
    padding-left: 1rem;
    font-style: italic;
    color: rgba(247, 243, 237, .8);
    margin: 0 0 1rem;
}
.sport-preview img { max-width: 100%; height: auto; border-radius: .5rem; margin: 0 auto; display: block; }

/* Light (cream) section — the "How It Works" block */
.sport-preview-light h1,
.sport-preview-light h2 { font-size: 2.25rem; line-height: 1.25; color: #1A1A1A; margin: 0 0 1rem; }
.sport-preview-light h1 { font-size: 3rem; }
.sport-preview-light h3 { font-size: 1.5rem; line-height: 1.3; color: #1A1A1A; margin: 0 0 .75rem; }
.sport-preview-light p { color: rgba(26, 26, 26, .7); line-height: 1.625; margin: 0 0 1rem; }
.sport-preview-light ul,
.sport-preview-light ol {
    list-style-position: inside;
    list-style-type: disc;
    margin: 0 0 1rem;
    padding-left: 0;
    color: rgba(26, 26, 26, .7);
}
.sport-preview-light ol { list-style-type: decimal; }
.sport-preview-light li { margin-bottom: .5rem; }
.sport-preview-light a { color: #C8960C; text-decoration: none; }
.sport-preview-light a:hover { text-decoration: underline; }
.sport-preview-light strong { color: #1A1A1A; font-weight: 600; }
.sport-preview-light blockquote {
    border-left: 2px solid rgba(200, 150, 12, .4);
    padding-left: 1rem;
    font-style: italic;
    color: rgba(26, 26, 26, .7);
    margin: 0 0 1rem;
}
.sport-preview-light img { max-width: 100%; height: auto; border-radius: .5rem; margin: 0 auto; display: block; }

/* ----------------------------------------------------------
   7. DARK PANEL MODE
   Applies only if the Filament panel is switched to dark.
   ---------------------------------------------------------- */

.dark .sport-editor {
    --sme-border: #3f3f46;
    --sme-border-strong: #52525b;
    --sme-chrome: #27272a;
    --sme-text: #e4e4e7;
    --sme-muted: #a1a1aa;
}

.dark .sport-editor .ck-editor__editable_inline {
    background-color: #18181b;
    color: #e4e4e7;
}

.dark .sport-editor .ck.ck-toolbar .ck-button { color: #e4e4e7; }
.dark .sport-editor .ck.ck-toolbar .ck-button:not(.ck-disabled):hover { background-color: #3f3f46; }
.dark .sport-editor .ck.ck-toolbar .ck-button.ck-on { background-color: #3730a3; color: #e0e7ff; }
.dark .sport-editor .ck-content a { color: #a5b4fc; }
.dark .sport-editor .ck-content blockquote { border-left-color: #52525b; color: #a1a1aa; }

.dark .sport-editor-btn { background-color: #27272a; color: #e4e4e7; border-color: #52525b; }
.dark .sport-editor-btn:hover { background-color: #3f3f46; border-color: #71717a; }
.dark .sport-editor-btn.is-on { background-color: #3730a3; border-color: #6366f1; color: #e0e7ff; }

.dark .sport-editor.is-full { background-color: #18181b; }

.dark .sport-preview-dialog { background-color: #18181b; }
.dark .sport-preview-head { background-color: #27272a; border-bottom-color: #3f3f46; }
.dark .sport-preview-title { color: #e4e4e7; }

/* CKEditor renders its balloons/dropdowns in a body-level root; keep them
   above the Filament section stacking context but below the preview modal. */
.ck.ck-balloon-panel,
.ck-body-wrapper .ck.ck-balloon-panel { z-index: 65; }
