@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #07111f;
    --bg-soft: #0b1728;
    --panel: #091526;
    --panel-2: #0d1b2f;
    --panel-3: #12243c;
    --line: rgba(132, 160, 201, 0.18);
    --text: #edf4ff;
    --muted: #8fa3c4;
    --accent: #b7f30d;
    --accent-2: #dfff84;
    --danger: #ff546f;
    --danger-soft: rgba(255, 84, 111, 0.12);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

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

html, body {
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(183, 243, 13, 0.08), transparent 20%),
        radial-gradient(circle at top right, rgba(94, 53, 177, 0.18), transparent 20%),
        linear-gradient(180deg, #050c18 0%, #07111f 50%, #081321 100%);
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text);
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(6, 16, 29, 0.98) 0%, rgba(7, 17, 31, 0.98) 100%);
    border-right: 1px solid var(--line);
    padding: 28px 18px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-top {
    padding: 6px 10px 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
}

.brand-logo {
    width: 50px;
    max-width: 100%;
    height: auto;
    display: block;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    color: var(--muted);
    border: 1px solid transparent;
    transition: 0.25s ease;
}

.sidebar-link i {
    width: 18px;
    text-align: center;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(183, 243, 13, 0.08);
    border-color: rgba(183, 243, 13, 0.14);
    color: var(--text);
}

.sidebar-bottom {
    margin-top: auto;
}

.workspace {
    padding: 28px;
}

.workspace-header {
    margin-bottom: 22px;
}

.eyebrow {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.74rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.workspace-header h1 {
    font-size: clamp(2rem, 3.5vw, 3.4rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.panel {
    background: linear-gradient(180deg, rgba(9, 21, 38, 0.98) 0%, rgba(7, 17, 31, 0.96) 100%);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.panel-form {
    padding: 22px 24px;
    margin-bottom: 22px;
}

.panel-history {
    padding: 24px;
}

.news-form {
    display: grid;
    gap: 16px;
}

.toolbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 16px;
    align-items: end;
}

.field-grow label,
.history-search label,
.history-controls label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.field-grow input,
.search-wrap input,
.history-controls select {
    width: 100%;
    background: rgba(18, 36, 60, 0.5);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 16px;
    min-height: 54px;
    padding: 0 18px;
    outline: none;
    transition: 0.2s ease;
}

.field-grow input:focus,
.search-wrap input:focus,
.history-controls select:focus {
    border-color: rgba(183, 243, 13, 0.4);
    box-shadow: 0 0 0 3px rgba(183, 243, 13, 0.12);
}

.search-wrap {
    position: relative;
}

.search-wrap i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.search-wrap input {
    padding-left: 46px;
}

.btn {
    border: none;
    border-radius: 16px;
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 18px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #10200b;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(183, 243, 13, 0.18);
}

.btn-icon {
    min-height: 40px;
    width: 40px;
    min-width: 40px;
    border-radius: 12px;
    padding: 0;
}

.btn-danger {
    background: var(--danger-soft);
    color: #ff98a9;
    border: 1px solid rgba(255, 84, 111, 0.18);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(255, 84, 111, 0.2);
    color: #ffd7de;
}

.loader {
    display: none;
    justify-items: center;
    gap: 10px;
    text-align: center;
    padding: 6px 0 0;
}

.loader.active {
    display: grid;
}

.loader p {
    color: var(--muted);
    font-size: 0.92rem;
}

.spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(183, 243, 13, 0.18);
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.alert {
    display: none;
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert.active {
    display: block;
}

.alert-success {
    background: rgba(183, 243, 13, 0.1);
    border-color: rgba(183, 243, 13, 0.18);
    color: #edf9c2;
}

.alert-error,
.alert-danger {
    background: rgba(255, 84, 111, 0.12);
    border-color: rgba(255, 84, 111, 0.18);
    color: #ffd8df;
}

.alert h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.98rem;
    margin-bottom: 6px;
}

.alert-content {
    font-size: 0.92rem;
    line-height: 1.6;
}

.history-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px;
    gap: 16px;
    margin-bottom: 18px;
}

.table-shell {
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(7, 16, 29, 0.75);
}

.history-grid {
    display: grid;
    grid-template-columns: 150px minmax(0, 1.6fr) minmax(220px, 0.8fr) 92px;
    gap: 16px;
    align-items: center;
}

.history-head {
    padding: 16px 18px;
    background: rgba(18, 36, 60, 0.72);
    color: var(--muted);
    font-size: 0.83rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.history-body {
    display: grid;
}

.history-row {
    padding: 18px;
    border-top: 1px solid rgba(132, 160, 201, 0.12);
    transition: 0.2s ease;
}

.history-row:hover {
    background: rgba(18, 36, 60, 0.3);
}

.history-date {
    color: var(--muted);
    font-size: 0.92rem;
}

.history-title-button {
    color: var(--text);
    font-weight: 600;
    font-size: 0.98rem;
    line-height: 1.45;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    padding: 0;
}

.history-title-button:hover {
    color: var(--accent-2);
}

.history-url {
    color: var(--muted);
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions-col,
.history-actions {
    justify-self: end;
}

.history-empty {
    padding: 42px 18px;
    text-align: center;
    color: var(--muted);
}

.pagination-bar {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--muted);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    min-width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(18, 36, 60, 0.45);
    color: var(--text);
    cursor: pointer;
    transition: 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    border-color: rgba(183, 243, 13, 0.22);
    color: var(--accent-2);
}

.pagination-btn.active {
    background: var(--accent);
    color: #10200b;
    border-color: transparent;
    font-weight: 800;
}

.pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 30;
}

.modal.active {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 10, 18, 0.76);
    backdrop-filter: blur(8px);
}

.modal-dialog {
    position: relative;
    width: min(1200px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    margin: 24px auto;
    background: linear-gradient(180deg, rgba(8, 19, 34, 0.98) 0%, rgba(5, 12, 24, 0.98) 100%);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    cursor: pointer;
    z-index: 1;
}

.modal-content {
    padding: 32px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.modal-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.modal-pill {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(183, 243, 13, 0.12);
    color: var(--accent-2);
    font-size: 0.86rem;
    font-weight: 700;
}

.modal-link {
    color: var(--muted);
    font-size: 0.9rem;
}

.modal-link:hover {
    color: var(--accent-2);
}

.modal-content h2 {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 22px;
}

.modal-block + .modal-block {
    margin-top: 24px;
}

.modal-block h3 {
    color: var(--accent);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
}

.modal-text {
    background: rgba(18, 36, 60, 0.34);
    border: 1px solid rgba(132, 160, 201, 0.12);
    border-radius: 20px;
    padding: 22px;
    color: #eff5ff;
    line-height: 1.8;
}

.modal-content-text {
    min-height: 280px;
}

.modal-text strong {
    color: var(--accent-2);
}

.modal-text em {
    color: #a8c2ff;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1120px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        padding-bottom: 16px;
    }

    .sidebar-bottom {
        display: none;
    }
}

@media (max-width: 900px) {
    .workspace {
        padding: 18px;
    }

    .toolbar-row,
    .history-toolbar,
    .history-grid {
        grid-template-columns: 1fr;
    }

    .history-head {
        display: none;
    }

    .history-row {
        gap: 10px;
    }

    .history-url {
        white-space: normal;
    }

    .history-actions,
    .actions-col {
        justify-self: start;
    }

    .modal-dialog {
        width: calc(100vw - 20px);
        margin: 10px auto;
        max-height: calc(100vh - 20px);
    }

    .modal-content {
        padding: 22px 18px;
        max-height: calc(100vh - 20px);
    }
}
