/* SlotterFly - Main CSS File */

/* 1. Базовые стили */
body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* 2. Навигация */
.navbar {
    padding: 0.5rem 1rem;
}

.nav-link {
    color: white;
    transition: color 0.3s ease-in-out;
}

.nav-link:hover,
.nav-link:focus {
    color: #007bff;
    text-decoration: none;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* 3. Контентные блоки */
.main-content {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.card-custom {
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
}

/* 4. Формы */
.form-section {
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
}

.form-section h3 {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1.25rem;
    font-weight: 500;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}

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

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* 5. Таблицы */
.table-custom {
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-custom thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.table-custom tbody tr:hover {
    background-color: #f8f9fa;
}

/* 6. Алерты и уведомления */
.alert {
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-dismissible .btn-close {
    padding: 0.5rem 0.75rem;
}

/* 7. HTMX специфичные стили */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}

/* Показывать только конкретные индикаторы, указанные в hx-indicator */
.htmx-request .htmx-indicator {
    opacity: 0;
}

.htmx-request.htmx-indicator {
    opacity: 0;
}

/* Специальные правила для целевых индикаторов */
.htmx-indicator.show {
    opacity: 1 !important;
}

/* Спиннер для загрузки */
.htmx-indicator.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 8. Модальные окна и формы inline */
.inline-form {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    margin: 0.5rem 0;
}

.inline-form .form-control {
    margin-bottom: 0.5rem;
}

.inline-form .btn {
    margin-right: 0.5rem;
    margin-top: 0.5rem;
}

/* 9. Услуги и расписание */
.service-item {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #ffffff;
    transition: box-shadow 0.3s ease;
}

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

.service-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 0.5rem;
}

.service-price {
    color: #28a745;
    font-weight: 600;
    font-size: 1.25rem;
}

.service-description {
    color: #6c757d;
    margin-top: 0.5rem;
}

.time-interval {
    display: inline-block;
    background-color: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin: 0.25rem;
    font-size: 0.875rem;
    border: 1px solid #ced4da;
}

.time-interval.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* 10. Состояния и статусы */
.status-active {
    color: #28a745;
    font-weight: 600;
}

.status-inactive {
    color: #6c757d;
    font-weight: 600;
}

.status-pending {
    color: #ffc107;
    font-weight: 600;
}

.status-error {
    color: #dc3545;
    font-weight: 600;
}

/* 11. Логин и авторизация */
.auth-container {
    max-width: 400px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #495057;
}

.auth-code {
    font-family: "Courier New", monospace;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    margin: 1rem 0;
    letter-spacing: 2px;
}

/* 12. Утилитарные классы */
.text-primary {
    color: #007bff !important;
}

.text-success {
    color: #28a745 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-muted {
    color: #6c757d !important;
}

.bg-light-custom {
    background-color: #f8f9fa !important;
}

.border-custom {
    border: 1px solid #dee2e6 !important;
}

.rounded-custom {
    border-radius: 6px !important;
}

.shadow-sm-custom {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.highlight {
    background-color: #fff3cd;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: #856404;
}

.center-text {
    text-align: center;
    display: block;
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
}

/* 13. Адаптивность */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
        margin-top: 0.5rem;
    }

    .auth-container {
        margin: 1rem;
        padding: 1.5rem;
    }

    .service-item {
        padding: 0.75rem;
    }

    .btn {
        margin-bottom: 0.5rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .navbar {
        padding: 0.25rem 0.5rem;
    }

    .main-content {
        padding: 0.75rem;
    }

    .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
    }
}

/* 14. Анимации */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-10px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 15. Специальные элементы */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 16. Кастомные компоненты */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #007bff;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #007bff;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #6c757d;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 17. Управление клиентами */
.clients-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.client-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.client-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.client-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

.client-avatar-mini {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1rem;
}

.client-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 2rem;
    margin: 0 auto;
}

.client-info {
    flex: 1;
    margin-left: 1rem;
}

.client-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
}

.client-details {
    font-size: 0.9rem;
    color: #6c757d;
}

.client-stats {
    text-align: right;
    font-size: 0.9rem;
}

.search-controls {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.analytics-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.analytics-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease;
}

.analytics-card:hover {
    transform: translateY(-2px);
}

.metric-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    height: 100%;
}

.metric-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.metric-label {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.metric-trend {
    font-size: 0.8rem;
    font-weight: 600;
}

.metric-trend.positive {
    color: #28a745;
}

.metric-trend.negative {
    color: #dc3545;
}

.metric-trend.neutral {
    color: #6c757d;
}

.metric-primary {
    color: #007bff;
}

.metric-success {
    color: #28a745;
}

.metric-info {
    color: #17a2b8;
}

.metric-warning {
    color: #ffc107;
}

.metric-danger {
    color: #dc3545;
}

.client-mini-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.client-mini-card:hover {
    background: #e9ecef;
}

.client-info-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    height: 100%;
}

.info-item {
    margin-bottom: 1rem;
}

.info-item label {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.25rem;
}

.info-value {
    color: #495057;
    font-size: 0.95rem;
}

.info-value a {
    color: #667eea;
    text-decoration: none;
}

.info-value a:hover {
    text-decoration: underline;
}

.notes-content {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    white-space: pre-wrap;
}

.progress-custom {
    height: 8px;
    border-radius: 4px;
}

.section-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.insight-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.insight-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-analytics {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-analytics i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.bookings-history {
    border-top: 1px solid #e9ecef;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.bookings-list {
    max-height: 400px;
    overflow-y: auto;
}

.booking-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.booking-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.booking-date {
    text-align: center;
    margin-right: 1rem;
    min-width: 60px;
}

.date-day {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
    line-height: 1;
}

.date-month {
    font-size: 0.8rem;
    color: #6c757d;
}

.booking-info {
    flex: 1;
}

.booking-service {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
}

.booking-time {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.booking-meta {
    font-size: 0.8rem;
}

.booking-status {
    margin-left: 1rem;
}

.empty-bookings {
    color: #6c757d;
}

.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

/* Адаптивность для клиентов */
@media (max-width: 768px) {
    .clients-header,
    .analytics-header {
        padding: 1rem 0;
    }

    .client-card {
        flex-direction: column;
        text-align: center;
    }

    .client-info {
        margin-left: 0;
        margin-top: 1rem;
    }

    .client-stats {
        text-align: center;
        margin-top: 1rem;
    }

    .booking-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .booking-date {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .booking-status {
        margin-left: 0;
        margin-top: 0.5rem;
        align-self: flex-end;
    }

    .metric-number {
        font-size: 2rem;
    }
}

/* 18. Dashboard Analytics Styles */
.dashboard-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.stat-card {
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-color, #007bff);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    line-height: 1;
}

.stat-label {
    color: #6c757d;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.trend-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.trend-up {
    background: #d4edda;
    color: #155724;
}

.trend-down {
    background: #f8d7da;
    color: #721c24;
}

.trend-neutral {
    background: #e2e3e5;
    color: #383d41;
}

.insight-card {
    border-left: 4px solid;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
}

.insight-card:hover {
    transform: translateX(5px);
}

.insight-success {
    border-left-color: #28a745;
    background: #d4edda;
    color: #155724;
}

.insight-warning {
    border-left-color: #ffc107;
    background: #fff3cd;
    color: #856404;
}

.insight-info {
    border-left-color: #17a2b8;
    background: #d1ecf1;
    color: #0c5460;
}

.booking-status {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-confirmed {
    background: #cce5ff;
    color: #004085;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

.insights-container {
    max-height: 400px;
    overflow-y: auto;
}

.insights-container::-webkit-scrollbar {
    width: 6px;
}

.insights-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.insights-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.insights-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Dashboard responsive styles */
@media (max-width: 768px) {
    .stat-value {
        font-size: 2rem;
    }

    .chart-container {
        height: 250px;
    }

    .stat-card {
        padding: 1rem;
    }

    .dashboard-card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .stat-value {
        font-size: 1.75rem;
    }

    .chart-container {
        height: 200px;
    }

    .trend-indicator {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Chart loading states */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #6c757d;
}

.chart-loading i {
    font-size: 2rem;
    margin-right: 0.5rem;
    animation: spin 1s linear infinite;
}

/* Dashboard animations */
.dashboard-card,
.stat-card,
.insight-card {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animations for cards */
.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}
.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}
.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}
.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

/* 19. Печать */
@media print {
    .navbar,
    .btn,
    .alert,
    .htmx-indicator {
        display: none !important;
    }

    .main-content {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .dashboard-card,
    .stat-card {
        box-shadow: none;
        border: 1px solid #000;
        break-inside: avoid;
    }

    .chart-container {
        height: auto;
    }
}
