/* ================= ADMIN ================= */

html, body {
    max-width: 100%;
    /*overflow-x: hidden;*/
}

body.admin {
    background: var(--bg-soft);
}

/* ================= ADMIN LAYOUT ================= */

.admin .dashboard {
    max-width: 1100px;
    margin: 60px auto;
    padding: 0 24px;
}

.admin .card {
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.admin .top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.admin table.table {
    width: 100%;
    border-collapse: collapse;
}

.admin table.table th,
.admin table.table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
}

.admin table.table th {
    font-weight: 600;
    color: var(--text-light);
}

.admin .actions a {
    margin-right: 12px;
    font-size: 14px;
    text-decoration: none;
}

.admin .actions a.delete {
    color: #b91c1c;
}

/* BADGES */

.admin .badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.admin .badge.facts {
    background: #e0f2fe;
    color: #0369a1;
}

.admin .badge.custom {
    background: #ede9fe;
    color: #5b21b6;
}

.admin .badge-muted {
    background: #eef2f7;
    color: #475569;
}

.admin .container.form {
    max-width: 900px;
    background: #fff;
    border-radius: 18px;
    padding: 32px;
    margin: 40px auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.admin h1 {
    margin-top: 0;
}

.admin .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin label {
    font-weight: 500;
}

.admin label .hint {
    color: var(--text-light);
    font-weight: 400;
    font-size: 13px;
}

.field-hint {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.4;
    margin-top: 4px;
}
.admin input[type="text"] {
    max-width: 420px;
}

.admin select {
    max-width: 320px;
}

.admin input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
}

.admin .actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.admin .btn-secondary {
    background: #e5e7eb;
    color: #111;
    padding: 14px 22px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
}

@media (max-width: 768px) {
    .btn-primary,
    .btn-secondary {
        padding: 10px 16px;
        font-size: 0.95rem;
        border-radius: 10px;
        line-height: 1.2;
    }
}
/* ================= MODAL ================= */

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.modal-box {
    position: relative;
    background: #fff;
    border-radius: 18px;
    padding: 28px 32px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 30px 60px rgba(0,0,0,0.25);
    animation: modalIn 0.2s ease-out;
}

.modal-box h3 {
    margin-top: 0;
    font-size: 20px;
}

.modal-box p {
    color: var(--text-light);
    margin: 12px 0 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #b91c1c;
}

a.delete {
    color: #dc2626;
}
a.delete:hover {
    text-decoration: underline;
}

/* ================= SCREEN EDITOR LAYOUT ================= */

.screen-editor {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    max-width: 1200px;
    margin: 40px auto;
    padding: 32px;
}

@media (min-width: 1024px) {
    .screen-editor {
        grid-template-columns: 1fr 1fr; /* 50 / 50 */
        align-items: start;
    }
}

/* ================= FORM ================= */

.screen-editor form {
    width: 100%;
}

.screen-editor input[type="text"],
.screen-editor input[type="number"],
.screen-editor select {
    width: 100%;
    max-width: none;
}


/* ================= PREVIEW (UNIFIED) ================= */

/* ================= ADMIN PREVIEW ================= */

.screen-preview {
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
}

.orientation-field {
    align-items: center;
}

.orientation-field > label:first-child {
    align-self: flex-start; /* tytuł + hint po lewej */
}

.orientation-field .radio {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.orientation-field .radio input {
    pointer-events: auto; /* 🔑 iOS */
}

.screen-preview-inner {
    width: 100%;
    aspect-ratio: 16 / 9;   /* tylko wizualna rama */
    min-height: 320px;

    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;

    background: #ffffff;
    border-radius: 8px;

    /* admin-friendly */
    padding: 24px;
    box-sizing: border-box;
}

.screen-preview-inner .preview-text {
    font-weight: 600;
    line-height: 1.2;
    word-break: break-word;
}

/* 🔧 DODANE: preview portrait */
.screen-preview-inner.portrait {
    aspect-ratio: 9 / 16;
    min-height: 480px;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== COLOR DOT PICKER ===== */

.color-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    flex-shrink: 0;
}

.color-btn {
    padding: 6px 12px;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
}

.color-btn:hover {
    background: #1d4ed8;
}



/* ===== BUTTON UX (GLOBAL) ===== */

/* wszystkie przyciski */
button,
.btn-primary,
.btn-secondary,
a.btn-primary,
a.btn-secondary {
    cursor: pointer;
}

/* hover – lekki feedback */
button:hover,
.btn-primary:hover,
.btn-secondary:hover {
    filter: brightness(0.97);
}

/* active – efekt kliknięcia */
button:active,
.btn-primary:active,
.btn-secondary:active {
    transform: translateY(1px);
}

/* usuń podkreślenia z <a> udających button */
a.btn-primary,
a.btn-secondary {
    text-decoration: none;
}


.hint {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 4px;
}

.preview {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #374151;
}



/* 🔑 MOBILE */
@media (max-width: 900px) {
    .screen-editor {
        grid-template-columns: 1fr;
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
/* ===== COLOR PICKER LAYOUT ===== */

.color-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* desktop – preview + button w jednej linii */
.color-picker .color-preview,
.color-picker .color-btn {
    align-self: flex-start;
}

/* mobile – twardo pod labelem */
@media (max-width: 768px) {
    .color-picker {
        gap: 10px;
    }

    .color-picker .color-preview,
    .color-picker .color-btn {
        align-self: stretch;
    }
}
