﻿/* Админ-панель - все стили в одном файле */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Основные стили */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    background-color: #f8f9fa;
}

/* Уведомления */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert svg {
    flex-shrink: 0;
}

/* Хедер */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

    .admin-header h1 {
        margin: 0;
        color: #2c3e50;
        font-size: 1.5rem;
        font-weight: 600;
    }

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.95rem;
    color: #555;
}

.btn-logout {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

    .btn-logout:hover {
        background: #c0392b;
    }

/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
 
}



    .stat-card.stat-active {
        border-top: 4px solid #2ecc71;
    }

    .stat-card.stat-expired {
        border-top: 4px solid #e74c3c;
    }

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 8px;
}

/* Панель управления */
.control-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-form-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-width: 250px;
    font-size: 0.95rem;
}

.status-select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 0.95rem;
    min-width: 150px;
}

.btn-search, .btn-reset {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.btn-search {
    background: #3498db;
    color: white;
}

    .btn-search:hover {
        background: #2980b9;
    }

.btn-reset {
    background: #f8f9fa;
    color: #555;
    border: 1px solid #ddd;
}

    .btn-reset:hover {
        background: #e9ecef;
    }

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-add, .btn-test {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
}

.btn-add {
    background: #2ecc71;
}

    .btn-add:hover {
        background: #27ae60;
    }

.btn-test {
    background: #9b59b6;
}

    .btn-test:hover {
        background: #8e44ad;
    }

/* Таблица */
.table-responsive {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.promo-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

    .promo-table th {
        background: #f8f9fa;
        padding: 16px 12px;
        text-align: left;
        font-weight: 600;
        color: #2c3e50;
        border-bottom: 2px solid #e9ecef;
        font-size: 0.9rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .promo-table td {
        padding: 16px 12px;
        border-bottom: 1px solid #e9ecef;
        vertical-align: middle;
    }

    .promo-table tr:hover {
        background-color: #f8f9fa;
    }

/* Стили ячеек таблицы */
.code-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.date-range {
    font-size: 0.8rem;
    color: #7f8c8d;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.discount-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

.badge-percent {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-fixed {
    background: #e8f5e9;
    color: #2e7d32;
}

.usage-cell {
    min-width: 120px;
}

.usage-bar {
    width: 100%;
    height: 24px;
    background: #f8f9fa;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    border-radius: 12px;
    transition: width 0.3s;
}

.usage-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2c3e50;
}

.date-cell {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.4;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 100px;
    text-align: center;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-expired {
    background: #fff3cd;
    color: #856404;
}

.status-pending {
    background: #d1ecf1;
    color: #0c5460;
}

.status-exhausted {
    background: #e2e3e5;
    color: #383d41;
}

/* Кнопки действий в таблице */
.action-buttons-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-enable {
    background: #d4edda;
    color: #155724;
}

    .btn-enable:hover {
        background: #c3e6cb;
    }

.btn-disable {
    background: #f8d7da;
    color: #721c24;
}

    .btn-disable:hover {
        background: #f5c6cb;
    }

.btn-edit {
    background: #d1ecf1;
    color: #0c5460;
}

    .btn-edit:hover {
        background: #bee5eb;
    }

.btn-delete {
    background: #f8d7da;
    color: #721c24;
}

    .btn-delete:hover {
        background: #f5c6cb;
    }

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

    .empty-state svg {
        margin-bottom: 16px;
    }

    .empty-state p {
        color: #7f8c8d;
        margin: 16px 0;
        font-size: 1rem;
    }

/* Информация в футере */
.info-footer {
    text-align: center;
    padding: 16px;
    color: #7f8c8d;
    font-size: 0.9rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Формы в модальных окнах */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

    .form-control:focus {
        border-color: #3498db;
        outline: none;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    }

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-check-input {
    margin: 0;
    width: 20px;
    height: 20px;
}

.form-check-label {
    color: #2c3e50;
    font-size: 0.95rem;
}

.btn-submit {
    padding: 12px 30px;
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

    .btn-submit:hover {
        background: #27ae60;
    }

.btn-cancel {
    padding: 12px 30px;
    background: #f8f9fa;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

    .btn-cancel:hover {
        background: #e9ecef;
        color: #333;
    }

.text-danger {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
}

/* ========== СТИЛИ МОДАЛЬНЫХ ОКОН ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s;
}



.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

    .modal-header h3 {
        margin: 0;
        color: #2c3e50;
        font-size: 1.3rem;
    }

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

    .btn-close:hover {
        background: #f8f9fa;
        color: #e74c3c;
    }

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

/* Служебные классы */
.mt-3 {
    margin-top: 1rem !important;
}

.py-5 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

/* ========== АДАПТИВНОСТЬ ========== */

/* Планшеты и маленькие десктопы */
@media (max-width: 1024px) {
    .admin-container {
        padding: 15px;
    }

    .promo-table {
        min-width: 900px;
    }
}

/* Планшеты */
@media (max-width: 768px) {
    .admin-container {
        padding: 10px;
    }

    .admin-header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1.8rem;
    }

    .control-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .search-form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input, .status-select {
        min-width: 100%;
        width: 100%;
    }

    .action-buttons {
        width: 100%;
        justify-content: center;
    }

    .btn-add, .btn-test {
        flex: 1;
        justify-content: center;
        min-width: 200px;
    }

    .promo-table {
        font-size: 0.85rem;
    }

        .promo-table th,
        .promo-table td {
            padding: 12px 8px;
        }

    .action-buttons-cell {
        justify-content: center;
    }

    .btn-action {
        width: 32px;
        height: 32px;
    }

    /* Адаптивность модальных окон */
    .modal-content {
        margin: 10px;
        max-height: 80vh;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column;
    }

    .btn-submit, .btn-cancel {
        width: 100%;
    }
}

/* Мобильные телефоны */
@media (max-width: 480px) {
    .admin-header h1 {
        font-size: 1.3rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 1.6rem;
    }

    .promo-table {
        font-size: 0.8rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-add, .btn-test {
        width: 100%;
    }

    /* Мобильные модальные окна */
    .modal-header {
        padding: 15px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 15px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
    .admin-container {
        padding: 5px;
    }

    .stats-grid {
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .control-panel {
        padding: 15px;
    }

    .promo-table th,
    .promo-table td {
        padding: 10px 6px;
        font-size: 0.75rem;
    }

    .status-badge, .discount-badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* ========== УЛУЧШЕНИЯ ДЛЯ TOCH-УСТРОЙСТВ ========== */
@media (hover: none) {
    .btn-action, .btn-add, .btn-test, .btn-search, .btn-reset, .btn-logout,
    .btn-submit, .btn-cancel, .btn-close {
        min-height: 44px;
        min-width: 44px;
    }

    .form-control, .status-select {
        font-size: 16px !important;
        padding: 14px;
    }

    .promo-table td, .promo-table th {
        padding: 14px 8px;
    }

    /* Увеличиваем тап-таргет для мобильных */
    .btn-action {
        width: 44px;
        height: 44px;
    }

    .modal-content {
        max-height: 85vh;
    }
}

/* Ландшафтная ориентация на мобильных */
@media (max-height: 500px) and (max-width: 900px) {
    .modal-content {
        max-height: 95vh;
        max-width: 95vw;
    }

    .modal-body {
        padding: 15px;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Высокие экраны */
@media (min-height: 800px) and (min-width: 1200px) {
    .modal-content {
        max-width: 700px;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Темная тема (опционально) */
@media (prefers-color-scheme: dark) {
    .admin-container {
        background-color: #1a1a1a;
    }

    .admin-header,
    .stat-card,
    .control-panel,
    .table-responsive,
    .info-footer,
    .modal-content {
        background: #2d2d2d;
        color: #e0e0e0;
    }

        .admin-header h1,
        .modal-header h3 {
            color: #e0e0e0;
        }

    .form-control,
    .search-input,
    .status-select {
        background: #3d3d3d;
        border-color: #555;
        color: #e0e0e0;
    }

    .promo-table th {
        background: #333;
        color: #e0e0e0;
    }

    .promo-table td {
        border-color: #444;
        color: #ccc;
    }

    .promo-table tr:hover {
        background-color: #333;
    }

    .status-badge,
    .discount-badge {
        color: #fff;
    }
}

/* Анимация строк таблицы */
@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.promo-table tbody tr {
    animation: fadeInRow 0.3s ease-out;
}

/* Прогресс бар для использования */
.usage-fill[style*="width: 100%"] {
    background: linear-gradient(90deg, #2ecc71, #27ae60);
}

.usage-fill[style*="width: 0%"] {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

/* Подсказки при наведении */
.btn-action[title]:hover::after,
.btn-add[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
  
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 5px;
}

.btn-action[title] {
    position: relative;
}

/* Кастомный скроллбар */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

    .modal-content::-webkit-scrollbar-thumb:hover {
        background: #555;
    }

/* Плавные переходы */
.btn-action,
.btn-add,
.btn-test,
.btn-search,
.btn-reset,
.btn-logout,
.btn-submit,
.btn-cancel,
.form-control,
.status-select {
    transition: all 0.2s ease-in-out;
}

    /* Фокус состояния для доступности */
    .btn-action:focus,
    .btn-add:focus,
    .btn-test:focus,
    .btn-search:focus,
    .btn-reset:focus,
    .btn-logout:focus,
    .btn-submit:focus,
    .btn-cancel:focus,
    .form-control:focus,
    .status-select:focus {
        outline: 2px solid #3498db;
        outline-offset: 2px;
    }

    /* Отключенные состояния */
    .btn-action:disabled,
    .btn-add:disabled,
    .btn-test:disabled,
    .btn-search:disabled,
    .btn-reset:disabled,
    .btn-submit:disabled,
    .btn-cancel:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }





/* Отключить все подскакивания */
*:hover {
    transform: none !important;
}




/* СТИЛЬ ДЛЯ БЕСКОНЕЧНОСТИ - ЯРКИЙ И КРУПНЫЙ */
.infinity-char {
    display: inline-block;
    font-size: 1.8em !important; /* КРУПНО */
    font-weight: 900 !important; /* ОЧЕНЬ ЖИРНО */
    
    line-height: 0.7;
    

    margin: 0 4px;
    padding: 2px;
   
  
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
   
}





/* Увеличиваем всю ячейку использования */
.usage-cell {
    min-height: 44px;
    display: flex;
    align-items: center;
}

.usage-bar {
    height: 32px !important; /* Выше */
}

.usage-text {
    font-size: 1rem !important; /* Крупнее текст */
    font-weight: 600;
}