/**
 * Стили для админ-панели
 * БЭМ методология + Vanilla JS
 */

/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #2563EB;
    --color-secondary: #1E40AF;
    --color-success: #10B981;
    --color-danger: #EF4444;
    --color-warning: #F59E0B;
    --color-info: #3B82F6;
    --color-text: #1F2937;
    --color-text-light: #6B7280;
    --color-bg: #F9FAFB;
    --color-white: #FFFFFF;
    --color-border: #E5E7EB;
    --sidebar-width: 250px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --transition: all 0.3s ease;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

/* Страница входа */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-form {
    background: var(--color-white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-form__header {
    text-align: center;
    margin-bottom: 32px;
}

.login-form__title {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}

.login-form__subtitle {
    font-size: 16px;
    color: var(--color-text-light);
}

.login-form__error {
    color: var(--color-danger);
    font-size: 14px;
    margin-bottom: 16px;
    min-height: 20px;
}

/* Форма */
.form-group {
    margin-bottom: 20px;
}

.form-group__label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
}

.form-group__input,
.form-group__textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    font-family: inherit;
}

.form-group__input:focus,
.form-group__textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group__textarea {
    resize: vertical;
}

.form-group__checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-group__checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Кнопки */
.button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    text-align: center;
}

.button--primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.button--primary:hover {
    background-color: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.button--secondary {
    background-color: var(--color-white);
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.button--secondary:hover {
    background-color: var(--color-bg);
}

.button--large {
    width: 100%;
    padding: 14px 24px;
    font-size: 18px;
}

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

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

.button--warning {
    background-color: var(--color-warning);
    color: var(--color-white);
}

.button--warning:hover {
    background-color: #d97706;
}

/* Кнопки с иконками */
.button[title] {
    font-size: 18px;
    padding: 8px 12px;
    min-width: 40px;
    line-height: 1.2;
}

/* Управление слотами */
.slots-container {
    background: var(--color-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.slots-grid {
    display: grid;
    gap: 16px;
}

.slot-group {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    background: var(--color-bg);
}

.slot-group__time {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text);
}

.slot-group__slots {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.slot {
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--color-border);
    transition: var(--transition);
}

.slot--available {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: var(--color-success);
}

.slot--occupied {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--color-danger);
}

.slot__time {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

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

.slot__icon {
    font-size: 16px;
}

.slot__text {
    font-size: 14px;
    font-weight: 500;
}

.slot--inactive {
    background-color: rgba(156, 163, 175, 0.1);
    border-color: #9ca3af;
    opacity: 0.6;
}

.slot__actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.slots-controls {
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.button--small {
    padding: 6px 10px;
    font-size: 14px;
    min-width: auto;
}

/* Админ-панель */
.admin-page {
    display: flex;
    min-height: 100vh;
}

/* Боковое меню */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
    color: var(--color-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.sidebar__header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.sidebar__nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar__link {
    display: block;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
}

.sidebar__link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

.sidebar__link--active {
    background-color: rgba(37, 99, 235, 0.2);
    color: var(--color-white);
    border-left: 4px solid var(--color-primary);
}

.sidebar__footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__logout {
    width: 100%;
    padding: 12px;
    background: rgba(239, 68, 68, 0.2);
    border: none;
    border-radius: 8px;
    color: var(--color-white);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

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

/* Контент */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
}

/* Страницы */
.page {
    display: none;
}

.page--active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.page__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page__title {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text);
}

.page__actions {
    display: flex;
    gap: 12px;
}

/* Статистика */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--color-white);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card__value {
    font-size: 36px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.stat-card__label {
    font-size: 14px;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Раздел дашборда */
.dashboard-section {
    background: var(--color-white);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.dashboard-section__title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Список записей */
.appointments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.appointment-item {
    padding: 16px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.appointment-item:hover {
    border-color: var(--color-primary);
    background-color: rgba(37, 99, 235, 0.02);
}

.appointment-item__info {
    flex: 1;
}

.appointment-item__time {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.appointment-item__client {
    color: var(--color-text-light);
}

.appointment-item__status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.appointment-item__status--pending {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}

.appointment-item__status--confirmed {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

/* Таблицы */
.appointments-table,
.clients-table,
.services-table {
    background: var(--color-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.table th {
    background-color: var(--color-bg);
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
}

.table tr:hover {
    background-color: rgba(37, 99, 235, 0.02);
}

/* Поиск и фильтры */
.search-input,
.select {
    padding: 10px 16px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.search-input:focus,
.select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.search-input {
    width: 300px;
}

.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

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

/* Информация о дате */
.date-info {
    position: absolute;
    bottom: -22px;
    left: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
}

.date-info--success {
    color: var(--color-success);
}

.date-info--warning {
    color: var(--color-warning);
}

/* Стили для календаря с подсветкой */
.appointments-date-picker {
    font-weight: 600;
    position: relative;
}

.appointments-date-picker[data-highlighted-dates]:not([value=""]) {
    border-color: var(--color-success);
    background-color: rgba(16, 185, 129, 0.05);
}

/* Подсветка input'а когда есть даты с записями */
.appointments-date-picker[data-highlighted-dates]:not([data-highlighted-dates=""]) {
    border: 2px solid var(--color-success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal--active {
    display: flex;
}

.modal__content {
    background: var(--color-white);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal__header {
    padding: 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal__title {
    font-size: 24px;
    font-weight: 600;
}

.modal__close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--color-text-light);
    line-height: 1;
}

.modal__close:hover {
    color: var(--color-text);
}

.modal__form {
    padding: 24px;
}

.modal__body {
    padding: 24px;
}

.modal__body p {
    margin-bottom: 16px;
    line-height: 1.6;
}

.modal__footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Загрузчик */
.loader {
    text-align: center;
    padding: 40px;
    color: var(--color-text-light);
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Гамбургер-меню */
.hamburger {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: var(--color-white);
    border: none;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.hamburger:hover {
    background: var(--color-bg);
}

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

.hamburger__line {
    width: 24px;
    height: 3px;
    background: var(--color-text);
    border-radius: 2px;
    transition: var(--transition);
}

.hamburger--active .hamburger__line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger--active .hamburger__line:nth-child(2) {
    opacity: 0;
}

.hamburger--active .hamburger__line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Оверлей для мобильного меню */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay--active {
    display: block;
    opacity: 1;
}

/* Адаптивность */

/* Планшеты */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .content {
        margin-left: 220px;
    }

    .table-container {
        overflow-x: auto;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar--active {
        left: 0;
    }

    .content {
        margin-left: 0;
        padding: 70px 16px 16px;
    }

    .page__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page__actions {
        width: 100%;
    }

    .page__actions .button {
        width: 100%;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    /* Мобильная версия таблиц - карточки */
    .table {
        font-size: 14px;
    }

    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
    }

    .table tr {
        margin-bottom: 16px;
        border: 2px solid var(--color-border);
        border-radius: 12px;
        padding: 16px;
        background: var(--color-white);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .table tr:hover {
        background: var(--color-white);
        border-color: var(--color-primary);
    }

    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border: none;
        min-height: 40px;
    }

    .table td:not(:last-child) {
        border-bottom: 1px solid var(--color-border);
    }

    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-text);
        margin-right: 16px;
        flex-shrink: 0;
        min-width: 100px;
    }

    .table td:last-child {
        padding-top: 16px;
        justify-content: flex-end;
        border-top: 2px solid var(--color-border);
        margin-top: 8px;
    }

    .table td:last-child::before {
        display: none;
    }

    /* Кнопки действий в мобильной версии таблиц */
    .table td:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .table .button--small {
        font-size: 16px;
        padding: 10px 14px;
        min-width: auto;
        white-space: nowrap;
    }

    /* Кнопки-иконки в слотах на мобильных */
    .slot__actions .button--small {
        font-size: 20px;
        padding: 12px;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Фильтры на мобильных - дата и статус в одну строку */
    .filters {
        flex-direction: row;
        gap: 8px;
    }

    .filters__item {
        flex: 1;
        min-width: 0;
    }

    .filters__item label {
        font-size: 12px;
    }

    .filters__item select,
    .filters__item input[type="date"] {
        font-size: 14px;
        padding: 8px;
    }

    #clear-appointments-filters {
        align-self: flex-end;
        padding: 8px 12px;
        font-size: 14px;
        white-space: nowrap;
    }

    /* Информация о дате на мобильных */
    .date-info {
        position: static;
        margin-top: 4px;
        font-size: 11px;
    }

    .modal__content {
        width: 95%;
        max-height: 90vh;
        margin: 20px;
    }

    .modal__header {
        padding: 16px;
    }

    .modal__title {
        font-size: 20px;
    }

    .modal__form,
    .modal__body {
        padding: 16px;
    }

    .slot-group__slots {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
    }

    .filters__item {
        width: 100%;
    }
}

/* Маленькие мобильные */
@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }

    .login-form {
        padding: 24px;
        margin: 16px;
    }

    .login-form__title {
        font-size: 24px;
    }

    .button {
        padding: 10px 20px;
        font-size: 14px;
    }

    .stat-card__value {
        font-size: 32px;
    }

    .dashboard-section {
        padding: 16px;
    }
}

/* Индикаторы уведомлений */
.notifications-status {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: help;
    transition: var(--transition);
}

.notification-badge--sent {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #10B981;
}

.notification-badge--pending {
    background-color: #FEF3C7;
    color: #92400E;
    border: 1px solid #F59E0B;
    opacity: 0.6;
}

.notification-badge:hover {
    transform: scale(1.05);
    opacity: 1;
}

