/* ============================================================
   СВОБОДНАЯ ПОЭЗИЯ – ОСНОВНОЙ СТИЛЬ
   ============================================================ */

/* --- Сброс и переменные --- */
:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --accent-hover: #2980b9;
    --success: #27ae60;
    --success-hover: #219a52;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --warning: #f39c12;
    --warning-hover: #d68910;
    --bg: #f5f7fa;
    --card-bg: #fff;
    --text: #333;
    --text-light: #666;
    --border: #ddd;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.05);
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    color: var(--primary);
    margin-bottom: 1rem;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ============================================================
   СТРАНИЦА АВТОРИЗАЦИИ
   ============================================================ */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-container {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.auth-container h1 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.auth-form h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.auth-form input,
.auth-form select,
.auth-form button {
    display: block;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    transition: var(--transition);
}

.auth-form input:focus,
.auth-form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52,152,219,0.2);
}

.auth-form button {
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    margin-top: 0.5rem;
}

.auth-form button:hover {
    background: var(--accent-hover);
}

.auth-form p {
    margin-top: 1rem;
    font-size: 0.95rem;
}

.register-links {
    margin-top: 1rem;
    font-size: 0.9rem;
    line-height: 1.8;
}

/* ============================================================
   УВЕДОМЛЕНИЯ (alert)
   ============================================================ */
.alert {
    padding: 0.8rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-size: 0.95rem;
}

.alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================================
   ШАПКА ПАНЕЛИ
   ============================================================ */
.dashboard-header {
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-header h1 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.user-menu span {
    color: #ecf0f1;
    font-size: 0.95rem;
}

.user-menu a {
    color: white;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    transition: var(--transition);
}

.user-menu a:hover {
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}

/* ============================================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================================ */
.dashboard-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.works-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.works-toolbar h2 {
    margin: 0;
}

/* ============================================================
   СЕТКИ КАРТОЧЕК
   ============================================================ */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* ============================================================
   КАРТОЧКА
   ============================================================ */
.work-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition);
    overflow: hidden;                 /* обрезаем выпадающий текст */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.work-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.work-card p,
.work-card li {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ============================================================
   СТАТУСЫ ПРОИЗВЕДЕНИЙ
   ============================================================ */
.card-status {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.status-draft { background: #dfe6e9; color: #636e72; }
.status-pending_review { background: #ffeaa7; color: #d68910; }
.status-in_review { background: #81ecec; color: #00838f; }
.status-needs_revision { background: #fab1a0; color: #c0392b; }
.status-rejected { background: #e17055; color: white; }
.status-published { background: #55efc4; color: #006266; }
.status-withdrawn { background: #b2bec3; color: #2d3436; }
.status-withdrawal_requested { background: #ffeaa7; color: #d68910; border: 1px dashed #f39c12; }

/* Статусы заявок правообладателей */
.status-pending { background: #ffeaa7; color: #d68910; }
.status-approved { background: #55efc4; color: #006266; }
.status-rejected { background: #e17055; color: white; }

/* ============================================================
   ТИП ПРОИЗВЕДЕНИЯ
   ============================================================ */
.work-type {
    display: inline-block;
    background: #ecf0f1;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-light);
    width: fit-content;
}

/* ============================================================
   ЗАГОЛОВКИ И МЕТА
   ============================================================ */
.work-card h3 {
    font-size: 1.1rem;
    margin: 0.25rem 0;
    color: var(--primary);
}

.work-card small {
    color: var(--text-light);
    font-size: 0.8rem;
}

/* ============================================================
   КОММЕНТАРИЙ РЕДАКТОРА
   ============================================================ */
.editor-comment {
    background: #fdebd0;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    border-left: 3px solid var(--warning);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================================
   КНОПКИ
   ============================================================ */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    background: #dfe6e9;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    text-align: center;
}

.btn:hover {
    background: #b2bec3;
    text-decoration: none;
    color: var(--text);
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-send { background: var(--warning); color: white; }
.btn-send:hover { background: var(--warning-hover); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: var(--success-hover); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-warning { background: #f39c12; color: white; }
.btn-warning:hover { background: #d68910; }

.btn-small { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* ============================================================
   ДЕЙСТВИЯ В КАРТОЧКАХ
   ============================================================ */
.card-actions {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.card-actions form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-actions textarea,
.filters textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    resize: vertical;
    min-height: 60px;
    font-size: 0.85rem;
}

/* ============================================================
   ФИЛЬТРЫ И ПОИСК
   ============================================================ */
.filters form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filters input[type="text"],
.filters select,
.filters input[type="search"] {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 150px;
    transition: var(--transition);
}

.filters input[type="text"]:focus,
.filters select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52,152,219,0.2);
}

/* ============================================================
   РЕДАКТОР ПРОИЗВЕДЕНИЯ
   ============================================================ */
.editor-container {
    max-width: 900px;
    margin: 2rem auto;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.editor-container input[type="text"],
.editor-container select {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

.editor-container select {
    background: white;
}

#editor-container {
    height: 400px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    -webkit-user-select: text;
    user-select: text;
    touch-action: pan-x pan-y pinch-zoom;
}

.ql-editor {
    min-height: 300px;
    font-size: 16px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ============================================================
   ПРОСМОТР ПРОИЗВЕДЕНИЯ
   ============================================================ */
.work-full-view {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.work-full-view h2 {
    margin: 1rem 0;
    font-size: 1.8rem;
}

.work-meta {
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.work-content {
    margin-top: 1.5rem;
    line-height: 1.8;
    font-size: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ============================================================
   ПРОФИЛЬ
   ============================================================ */
.profile-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar-small {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #dfe6e9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 0.7rem;
    font-weight: bold;
}

.profile-status-badge {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-unverified { background: #dfe6e9; color: #636e72; }
.status-verified { background: #55efc4; color: #006266; }
.status-rejected { background: #e17055; color: white; }
.status-pending { background: #ffeaa7; color: #d68910; }

/* ============================================================
   ФОРМА ПРОФИЛЯ
   ============================================================ */
.profile-form {
    max-width: 600px;
    margin: 2rem 0;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.profile-form label {
    display: block;
    margin-top: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.profile-form textarea,
.profile-form input[type="text"],
.profile-form input[type="email"] {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    resize: vertical;
}

.avatar-section {
    margin-bottom: 1.5rem;
    text-align: center;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 0.5rem;
    border: 3px solid var(--border);
}

/* ============================================================
   ПРОСМОТР ПРОФИЛЯ
   ============================================================ */
.profile-full {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 700px;
    margin: 0 auto;
}

.avatar-large img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    display: block;
    margin: 0 auto 1rem;
}

.avatar-placeholder-large {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: #dfe6e9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    margin: 0 auto 1rem;
    font-weight: bold;
}

.bio-block, .social-block {
    margin-top: 1.5rem;
}

.social-block ul {
    list-style: none;
    padding: 0;
}

.social-block li {
    margin-bottom: 0.5rem;
    word-break: break-all;
}

/* ============================================================
   КАРТОЧКА ПОЛЬЗОВАТЕЛЯ (для управления)
   ============================================================ */
.user-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-status .badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.badge-danger { background: #e17055; color: white; }
.badge-success { background: #55efc4; color: #006266; }

.permissions {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.checkbox-group label {
    display: block;
    font-size: 0.85rem;
}

/* ============================================================
   ЗАЯВКИ ПРАВООБЛАДАТЕЛЕЙ
   ============================================================ */
.claim-detail ul {
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.claim-detail a {
    word-break: break-all;
}

/* ============================================================
   УВЕДОМЛЕНИЯ (колокольчик)
   ============================================================ */
.notification-bell {
    position: relative;
    cursor: pointer;
    margin-left: 1rem;
}

.badge-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
}

.dropdown-notifications {
    display: none;
    position: absolute;
    right: 0;
    background: white;
    min-width: 250px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 6px;
    z-index: 100;
    padding: 0.5rem 0;
}

.notification-bell:hover .dropdown-notifications {
    display: block;
}

.notification-item {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.notification-item:last-child {
    border-bottom: none;
}

.mark-read-link {
    display: block;
    text-align: center;
    padding: 0.5rem;
    background: #f5f7fa;
    color: var(--accent);
    text-decoration: none;
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        text-align: center;
    }
    .works-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-content {
        padding: 1rem;
    }
    .editor-container,
    .profile-form,
    .profile-full {
        padding: 1.5rem;
    }
    .profile-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .filters form {
        flex-direction: column;
        align-items: stretch;
    }
    .filters input[type="text"],
    .filters select {
        width: 100%;
    }
}

@media (min-width: 1600px) {
    .dashboard-content {
        max-width: 1600px;
    }
    .works-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}