/* ============================================================
   TJ SKI SLAVOJ BRUNTÁL – styly administrace (inline správa webu)
   Modaly, formuláře v modalech, nástroje u stránek a karet, toasty.
   Barevné proměnné jsou v css/style.css.
   ============================================================ */

/* --- Nástroje u stránky a sekcí --- */
.admin-tools {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.admin-tools--inline {
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.admin-tools--subsection {
    margin-bottom: 0;
    flex-shrink: 0;
}

.admin-tools__hint {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-right: 0.35rem;
}

.admin-page-tools {
    margin-top: 1.5rem;
}

.admin-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--navy);
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 34, 74, 0.08);
    transition: all 0.2s ease;
}

.admin-tool:hover {
    border-color: var(--blue);
    color: var(--blue);
    transform: translateY(-1px);
}

.admin-tool--toggle.is-inactive {
    opacity: 0.45;
    border-style: dashed;
}

.admin-tool--toggle.is-inactive:hover {
    opacity: 1;
}

.admin-tool--delete:hover {
    border-color: #E57373;
    color: #D32F2F;
    background: #FFF5F5;
}

.admin-tool.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}

.page-subsection--bg-modra .admin-tool,
.page-subsection--photo .admin-tool {
    background: rgba(255, 255, 255, 0.92);
}

.admin-inline-container {
    position: relative;
}

.admin-inline-edit {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

.hero__content .admin-inline-edit {
    top: -0.5rem;
    right: auto;
    left: 0;
}

.footer__grid .admin-inline-edit,
.nav__footer .admin-inline-edit {
    top: -0.25rem;
}

.page-header--inactive {
    opacity: 0.7;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(0, 51, 102, 0.04) 12px, rgba(0, 51, 102, 0.04) 24px);
}

/* Přidání stránky v menu */
.nav__admin-add {
    display: flex;
    margin-right: 0.35rem;
}

.nav__add-page {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px dashed var(--ice-2);
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.nav__add-page:hover {
    border-color: var(--blue);
    border-style: solid;
    color: var(--blue);
    background: var(--blue-light);
}

/* --- Akce na kartách prvků --- */
.staff-card__actions,
.blok-card__actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 20;
}

.staff-card:hover .staff-card__actions,
.blok-card:hover .blok-card__actions,
.blok-inline-item:hover .blok-card__actions,
.news-card:hover .staff-card__actions,
.news-item:hover .staff-card__actions,
.gallery-card:hover .staff-card__actions,
.staff-card__actions:focus-within,
.blok-card__actions:focus-within {
    opacity: 1;
}

.staff-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.96);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 34, 74, 0.2);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.staff-action:hover {
    background: var(--blue);
    color: var(--white);
    transform: scale(1.06);
}

.staff-action--delete:hover {
    background: #D32F2F;
}

.staff-action--remove:hover {
    background: var(--ice);
    color: var(--navy);
}

.staff-action--move {
    cursor: grab;
}

.staff-action--move:active {
    cursor: grabbing;
}

/* --- Karta „Přidat …“ --- */
.admin-attach-item,
.admin-attach-look {
    border: 2px dashed var(--ice-2);
    background: var(--snow);
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
    min-height: 160px;
    padding: 1.5rem;
    font-family: var(--font-body);
    box-shadow: none;
    border-radius: var(--radius);
}

.admin-attach-item:hover,
.admin-attach-look:hover {
    border-color: var(--blue);
    background: var(--blue-light);
    color: var(--navy);
    transform: none;
}

.gallery-card--attach {
    aspect-ratio: 4 / 3;
    min-height: 0;
}

.admin-attach-card__icon {
    font-size: 2.4rem;
    line-height: 1;
    color: var(--blue);
    font-weight: 400;
}

.admin-attach-card__text {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
    text-align: center;
}

.page-add-section {
    padding: 1.5rem 1.25rem 2.5rem;
}

.page-add-section__button {
    width: 100%;
    min-height: 110px;
}

/* --- Toast --- */
.admin-toast {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--navy);
    color: var(--white);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    z-index: 3000;
    animation: toastIn 0.3s ease-out, toastOut 0.3s 2.5s ease-in forwards;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.admin-toast--success {
    border-left: 4px solid #4CAF50;
}

.admin-toast--error {
    border-left: 4px solid #EF5350;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* --- Modaly --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 20, 45, 0.55);
    z-index: 2000;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

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

.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 1100px;
    margin: auto 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-box--narrow {
    max-width: 520px;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-box__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.modal-box__title {
    font-size: 1.6rem;
    text-transform: uppercase;
}

.modal-box__close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--muted);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.modal-box__close:hover {
    color: var(--navy);
}

.modal-box__body {
    padding: 1.75rem 2rem 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-box__body .form-group {
    position: relative;
    margin-bottom: 1.2rem;
}

.modal-box__body .form-group label {
    position: absolute;
    top: -0.55em;
    left: 0.75rem;
    background: var(--white);
    padding: 0 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    z-index: 1;
    line-height: 1;
    pointer-events: none;
}

.modal-box__body .form-control {
    background: var(--white);
}

.modal-box__footer {
    padding: 1.1rem 2rem;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

.modal-box__footer .btn {
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row--media-inline {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: nowrap;
}

.form-row--media-inline .form-group--wide {
    flex: 1 1 auto;
    min-width: 0;
}

.form-row--media-inline .form-group--compact {
    flex: 0 0 auto;
}

.form-row--page-type {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: start;
}

.form-row--zdroj {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: start;
}

.form-row--zdroj .form-control:disabled {
    background: var(--snow);
    color: var(--muted);
    cursor: not-allowed;
}

.form-helper {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.4rem;
    line-height: 1.4;
}

.form-helper--note {
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    background: var(--blue-light);
    color: var(--navy);
    margin: 0 0 1.25rem;
}

.form-helper__preview {
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-width: 220px;
    background: var(--snow);
    position: relative;
}

.form-helper__preview img {
    display: block;
    width: 100%;
    height: auto;
}

.form-helper__remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: var(--white);
    cursor: pointer;
    line-height: 1;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-helper__remove.is-active {
    background: var(--error);
}

.media-file {
    position: relative;
    min-width: 240px;
}

.media-file__field {
    position: relative;
}

.media-file__field .form-control {
    min-width: 0;
    padding-right: 2rem;
}

.media-file__field .form-helper__remove {
    position: absolute;
    top: 50%;
    right: 0.55rem;
    transform: translateY(-50%);
    width: auto;
    height: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1rem;
}

.media-file__field .form-helper__remove:hover {
    color: var(--error);
}

.media-file__popup {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    width: 180px;
    padding: 0.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--white);
    box-shadow: var(--shadow-card);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 30;
}

.media-file__popup img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 140px;
    object-fit: contain;
}

.media-file:hover .media-file__popup,
.media-file:focus-within .media-file__popup {
    opacity: 1;
    transform: translateY(0);
}

.form-control--compact {
    width: auto;
    min-width: 9rem;
}

.form-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 0.5rem;
}

/* Fotky koláže v okně „Upravit hero“ */
.hero-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.hero-photo {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: var(--snow);
    border: 1px solid var(--line);
}

.hero-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-photo--hidden img {
    opacity: 0.4;
}

.hero-photo__badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--navy, #003366);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
}

.hero-photo--hidden .hero-photo__badge {
    background: rgba(0, 0, 0, 0.55);
}

.hero-photo__new {
    position: absolute;
    bottom: 6px;
    left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #fff;
    color: var(--navy, #003366);
    font-size: 0.7rem;
    font-weight: 600;
}

.hero-photo__tools {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 3px;
}

.hero-photo__btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.92);
    color: var(--navy, #003366);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.hero-photo__btn:hover:not(:disabled) {
    background: #fff;
    color: var(--blue);
}

.hero-photo__btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.hero-photo__btn--remove:hover:not(:disabled) {
    color: #c0392b;
}

.hero-photo--add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    border: 2px dashed var(--line);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
}

.hero-photo--add span {
    font-size: 1.6rem;
    line-height: 1;
}

.hero-photo--add:hover,
.hero-photo--add.is-dragover {
    border-color: var(--blue);
    color: var(--blue);
}

/* Pásek pod hero – řádky v editoru */
.hero-strip-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.hero-strip-row__move {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hero-strip-row__move-btn {
    width: 22px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: var(--snow);
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.hero-strip-row__move-btn:hover:not(:disabled) {
    color: var(--blue);
}

.hero-strip-row__move-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.hero-strip-row__icon-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 9rem;
}

.hero-strip-row__preview {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--blue);
    background: var(--blue-light);
}

.hero-strip-row__text {
    flex: 1 1 auto;
    min-width: 0;
}

.hero-strip-row__remove {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: var(--muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.hero-strip-row__remove:hover {
    background: var(--error);
    color: var(--white);
}

.hero-strip-row__remove:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.hero-strip-add {
    margin-top: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
}

.hero-strip-add:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Přidání existujícího prvku / nový prvek */
.attach-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.attach-tab {
    border: 1px solid var(--line);
    background: var(--snow);
    color: var(--text);
    border-radius: var(--radius-pill);
    padding: 0.45rem 1.1rem;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.attach-tab.is-active {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--white);
}

.attach-panel .modal-box__footer {
    margin: 1rem -2rem -1.25rem;
}

/* CKEditor */
.ck-editor__editable,
.ck-content {
    font-family: var(--font-body);
}

.ck-editor__editable.ck-editor__editable_inline {
    min-height: 96px;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    resize: vertical !important;
}

.ck.ck-balloon-panel,
.ck.ck-dropdown__panel,
.ck-body-wrapper {
    z-index: 2600 !important;
}

.ck.ck-editor__main > .ck-editor__editable {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 0.75rem;
    }

    .modal-box__header,
    .modal-box__body,
    .modal-box__footer {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .form-row,
    .form-row--page-type,
    .form-row--zdroj {
        grid-template-columns: 1fr;
    }

    .form-row--media-inline {
        flex-wrap: wrap;
    }

    .attach-panel .modal-box__footer {
        margin: 1rem -1.25rem -1.25rem;
    }

    .staff-card__actions,
    .blok-card__actions {
        opacity: 1;
    }
}
