/**
 * Стили админ-панели виджета обратной связи
 */

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Roboto', Arial, sans-serif;
    background: #f4f7ff;
    color: #1b1f33;
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #10152f 0%, #1d2c63 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px;
}

.sidebar-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.nav-item.active {
    background: rgba(63, 97, 219, 0.2);
    color: #fff;
    border-left-color: #3f61db;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-logout {
    color: rgba(255, 100, 100, 0.7) !important;
}

.nav-logout:hover {
    background: rgba(255, 100, 100, 0.1) !important;
    color: #ff6b6b !important;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 12px 20px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3f61db, #2578fc);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
}

.sidebar-username {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-role {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

/* ===== Main Content ===== */
.admin-main {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== Topbar ===== */
.admin-topbar {
    background: #fff;
    padding: 20px 32px;
    border-bottom: 1px solid #e8edf8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.admin-topbar h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1b1f33;
}

.back-link {
    color: #3f61db;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.back-link:hover {
    text-decoration: underline;
}

.ticket-status-badge {
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
}

.ticket-status-badge.status-open {
    background: rgba(50, 186, 124, 0.12);
    color: #32ba7c;
}

.ticket-status-badge.status-closed {
    background: rgba(176, 184, 204, 0.2);
    color: #b0b8cc;
}

.ticket-status-badge.status-pending {
    background: rgba(255, 138, 0, 0.12);
    color: #ff8a00;
}

/* ===== Stats ===== */
.topbar-stats {
    display: flex;
    gap: 16px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 20px;
    border-radius: 12px;
    background: #f4f7ff;
    min-width: 80px;
}

.stat-card.stat-open {
    background: rgba(50, 186, 124, 0.1);
}

.stat-card.stat-pending {
    background: rgba(255, 138, 0, 0.1);
}

.stat-card.stat-closed {
    background: rgba(176, 184, 204, 0.15);
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
}

.stat-card.stat-open .stat-number { color: #32ba7c; }
.stat-card.stat-pending .stat-number { color: #ff8a00; }
.stat-card.stat-closed .stat-number { color: #b0b8cc; }

.stat-label {
    font-size: 11px;
    color: #1b1f33;
    opacity: 0.7;
    margin-top: 2px;
}

/* ===== Filters ===== */
.admin-filters {
    padding: 16px 32px;
    background: #fff;
    border-bottom: 1px solid #e8edf8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-btn {
    padding: 8px 18px;
    border: 2px solid #dfe5f3;
    border-radius: 100px;
    background: #fff;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #1b1f33;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #3f61db;
    color: #3f61db;
}

.filter-btn.active {
    background: #3f61db;
    border-color: #3f61db;
    color: #fff;
}

/* ===== Content ===== */
.admin-content {
    padding: 24px 32px;
    flex: 1;
}

/* ===== Table ===== */
.table-wrapper {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(28, 51, 140, 0.06);
}

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

.admin-table thead {
    background: #f4f7ff;
}

.admin-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #1b1f33;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e8edf8;
}

.admin-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f4f7ff;
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: background 0.15s;
}

.admin-table tbody tr:hover {
    background: #f4f7ff;
}

.admin-table tbody tr:hover td:first-child {
    color: #3f61db;
}

.admin-table tbody tr {
    cursor: pointer;
}

.table-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
}

.table-status.open {
    background: rgba(50, 186, 124, 0.12);
    color: #32ba7c;
}

.table-status.closed {
    background: rgba(176, 184, 204, 0.2);
    color: #b0b8cc;
}

.table-status.pending {
    background: rgba(255, 138, 0, 0.12);
    color: #ff8a00;
}

.table-actions {
    display: flex;
    gap: 6px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-icon.btn-view {
    background: rgba(63, 97, 219, 0.1);
    color: #3f61db;
}

.btn-icon.btn-view:hover {
    background: #3f61db;
    color: #fff;
}

.btn-icon.btn-close {
    background: rgba(217, 48, 37, 0.1);
    color: #d93025;
}

.btn-icon.btn-close:hover {
    background: #d93025;
    color: #fff;
}

.table-loading {
    text-align: center;
    padding: 40px !important;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.page-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #dfe5f3;
    border-radius: 8px;
    background: #fff;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: #1b1f33;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.page-btn:hover {
    border-color: #3f61db;
    color: #3f61db;
}

.page-btn.active {
    background: #3f61db;
    border-color: #3f61db;
    color: #fff;
}

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

/* ===== Dialogue Layout ===== */
.dialogue-layout {
    display: flex;
    gap: 24px;
    padding: 24px 32px;
    flex: 1;
    overflow: hidden;
}

.ticket-info {
    width: 280px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(28, 51, 140, 0.06);
    height: fit-content;
}

.ticket-info h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 20px;
    color: #1b1f33;
}

.info-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 11px;
    font-weight: 700;
    color: #b0b8cc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 14px;
    color: #1b1f33;
    word-break: break-all;
}

.ticket-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f4f7ff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 100px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #ff8a00, #ff6b00);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 142, 1, 0.4);
}

.btn-danger {
    background: #d93025;
    color: #fff;
}

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

.btn-secondary {
    background: #f4f7ff;
    color: #1b1f33;
}

.btn-secondary:hover {
    background: #e8edf8;
}

/* ===== Messages Panel ===== */
.messages-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(28, 51, 140, 0.06);
    overflow: hidden;
    min-height: 0;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-message {
    max-width: 80%;
}

.admin-message.client {
    align-self: flex-start;
}

.admin-message.admin {
    align-self: flex-end;
}

.admin-message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 12px;
}

.admin-message.client .admin-message-header {
    justify-content: flex-start;
}

.admin-message.admin .admin-message-header {
    justify-content: flex-end;
}

.admin-message-sender {
    font-weight: 500;
    color: #3f61db;
}

.admin-message.admin .admin-message-sender {
    color: #ff8a00;
}

.admin-message-time {
    color: #b0b8cc;
    font-size: 11px;
}

.admin-message-text {
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.admin-message.client .admin-message-text {
    background: #f4f7ff;
    border: 1px solid #e8edf8;
    border-bottom-left-radius: 4px;
    color: #1b1f33;
}

.admin-message.admin .admin-message-text {
    background: linear-gradient(135deg, #3f61db, #2578fc);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ===== Reply Form ===== */
.reply-form {
    padding: 20px 24px;
    border-top: 1px solid #f4f7ff;
    background: #fafbfd;
}

.reply-form .fw-textarea {
    width: 100%;
    min-height: 80px;
    max-height: 150px;
    border: 2px solid #dfe5f3;
    border-radius: 16px;
    padding: 14px 16px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: #1b1f33;
    background: #fff;
    resize: vertical;
    margin-bottom: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.reply-form .fw-textarea:focus {
    outline: none;
    border-color: #3f61db;
    box-shadow: 0 0 0 3px rgba(63, 97, 219, 0.1);
}

.reply-actions {
    display: flex;
    justify-content: flex-end;
}

.closed-notice {
    padding: 20px 24px;
    text-align: center;
    background: #fff;
    color: #b0b8cc;
    font-size: 14px;
    border-top: 1px solid #f4f7ff;
}

/* ===== Empty State ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 30px;
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    color: #1b1f33;
}

.empty-state p {
    font-size: 14px;
    color: #b0b8cc;
    margin: 0 0 24px;
}

/* ===== Spinner ===== */
.fw-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f4f7ff;
    border-top-color: #3f61db;
    border-radius: 50%;
    animation: fw-spin 0.8s linear infinite;
}

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

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 220px;
    }
    .admin-main {
        margin-left: 220px;
    }
    .dialogue-layout {
        flex-direction: column;
    }
    .ticket-info {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
    }
    .admin-main {
        margin-left: 0;
    }
    .admin-topbar {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
    }
    .admin-filters {
        padding: 12px 20px;
        flex-direction: column;
    }
    .admin-content {
        padding: 16px 20px;
    }
    .dialogue-layout {
        padding: 16px 20px;
        flex-direction: column;
    }
    .table-wrapper {
        overflow-x: auto;
    }
    .admin-table {
        min-width: 700px;
    }
}

