/**
 * Стили для внешнего личного кабинета
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.admin-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    background: #2066b0;
    color: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.admin-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-user {
    font-size: 14px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #2066b0;
    color: white;
}

.btn-primary:hover {
    background: #1a5590;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.admin-nav {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 30px;
}

.admin-nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.admin-nav a {
    display: block;
    padding: 15px 0;
    text-decoration: none;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: #2066b0;
    border-bottom-color: #2066b0;
}

.admin-main {
    flex: 1;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.admin-tab {
    display: none;
}

.admin-tab.active {
    display: block;
}

.admin-section {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.admin-section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.widgets-list {
    display: grid;
    gap: 20px;
}

.widget-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
}

.widget-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.widget-item-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.widget-key {
    font-size: 12px;
    color: #999;
    font-family: monospace;
}

.widget-item-body {
    margin-bottom: 15px;
}

.widget-item-body p {
    margin: 5px 0;
    color: #666;
}

.widget-item-footer {
    display: flex;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #2066b0;
}

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.products-selector {
    margin-bottom: 15px;
}

.products-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
}

.product-item {
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.product-item:hover {
    background: #f0f0f0;
    border-color: #2066b0;
}

.product-item.selected {
    background: #e3f2fd;
    border-color: #2066b0;
}

.selected-products {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.selected-product-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #2066b0;
    color: white;
    border-radius: 20px;
    font-size: 14px;
}

.selected-product-tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.code-textarea {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    min-height: 150px;
    resize: vertical;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.analytics-placeholder {
    text-align: center;
    padding: 60px;
    color: #999;
}

.analytics-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #2066b0;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group .form-control {
    flex: 1;
}

/* =========================================================================
   ТОВАРНЫЕ ФИДЫ
   ========================================================================= */

.feeds-list {
    display: grid;
    gap: 20px;
}

.feed-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    transition: all 0.3s;
}

.feed-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.feed-item.feed-inactive {
    opacity: 0.7;
    background: #f5f5f5;
}

.feed-item-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.feed-icon {
    width: 48px;
    height: 48px;
    background: #2066b0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.feed-icon svg {
    width: 24px;
    height: 24px;
}

.feed-icon.feed-type-yml { background: #f5c518; }
.feed-icon.feed-type-csv { background: #4caf50; }
.feed-icon.feed-type-bitrix { background: #e91e63; }
.feed-icon.feed-type-google_merchant { background: #4285f4; }

.feed-info {
    flex: 1;
}

.feed-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.feed-type-label {
    font-size: 12px;
    color: #666;
}

.feed-status {
    text-align: right;
}

.feed-item-body {
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e8e8e8;
}

.feed-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.feed-stat {
    display: flex;
    gap: 8px;
}

.feed-stat .stat-label {
    color: #666;
    font-size: 13px;
}

.feed-stat .stat-value {
    font-weight: 600;
    font-size: 13px;
}

.feed-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
}

.feed-message-failed,
.feed-message-error {
    background: #ffebee;
    color: #c62828;
}

.feed-message-partial {
    background: #fff3e0;
    color: #e65100;
}

.feed-item-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* =========================================================================
   ТАБЛИЦА ТОВАРОВ
   ========================================================================= */

.products-table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.products-table th,
.products-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.products-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.products-table tr:hover {
    background: #f5f5f5;
}

.products-table tr.product-inactive {
    opacity: 0.6;
}

.product-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.product-name {
    font-weight: 500;
    color: #333;
}

.product-sku {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.product-price {
    font-weight: 600;
    color: #2066b0;
}

.product-old-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

.stock-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.stock-available {
    background: #e8f5e9;
    color: #2e7d32;
}

.stock-empty {
    background: #ffebee;
    color: #c62828;
}

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

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

/* =========================================================================
   СТАТУСЫ
   ========================================================================= */

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

.status-active,
.status-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-inactive {
    background: #f5f5f5;
    color: #757575;
}

.status-warning {
    background: #fff3e0;
    color: #e65100;
}

.status-error {
    background: #ffebee;
    color: #c62828;
}

.status-running {
    background: #e3f2fd;
    color: #1565c0;
}

/* =========================================================================
   ПАГИНАЦИЯ
   ========================================================================= */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

/* =========================================================================
   МОДАЛЬНЫЕ ОКНА
   ========================================================================= */

.modal-large {
    max-width: 800px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #666;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.logs-table th,
.logs-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.logs-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.logs-table .log-row-failed,
.logs-table .log-row-error {
    background: #ffebee;
}

.logs-table .log-row-partial {
    background: #fff3e0;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 30px !important;
}

/* =========================================================================
   ФИЛЬТРЫ
   ========================================================================= */

.products-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* =========================================================================
   АДАПТИВНОСТЬ
   ========================================================================= */

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-header-content {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .admin-nav ul {
        flex-wrap: wrap;
        gap: 15px;
    }

    .feed-item-header {
        flex-wrap: wrap;
    }

    .feed-stats {
        flex-direction: column;
        gap: 10px;
    }

    .products-filters {
        flex-direction: column;
    }

    .products-filters .form-control {
        width: 100% !important;
    }
}
