/* Основные стили */
html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
    flex: 1;
    overflow-y: auto;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Layout стили */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar {
    background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
}

.top-row {
    background-color: #f7f7f7;
    border-bottom: 1px solid #d6d5d5;
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-content {
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Стили для новых страниц */
.sites-container, .work-types-container, .avances-container {
    padding: 1.5rem;
}

/* Мобильные стили для контейнеров страниц */
@media (max-width: 768px) {
    .sites-container, .work-types-container, .avances-container {
        padding: 0;
    }
}

@media (max-width: 480px) {
    .sites-container, .work-types-container, .avances-container {
        padding: 0;
    }
}

@media (max-width: 360px) {
    .sites-container, .work-types-container, .avances-container {
        padding: 0;
    }
}

.page-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.page-header h1 {
    color: #1f2937;
    font-weight: 600;
    margin: 0;
}

/* Статистика */
.sites-stats, .work-types-stats, .avances-stats, .users-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-item .stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    color: #4f46e5;
    margin-bottom: 0.5rem;
}

.stat-item .stat-label {
    color: #6b7280;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Фильтры */
.sites-filters, .work-types-filters, .avances-filters {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

/* Таблицы */
.table-responsive {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table th {
    background-color: #f8fafc;
    border-top: none;
    font-weight: 600;
    color: #374151;
    padding: 1rem;
    position: relative;
}

.table td {
    padding: 1rem;
    vertical-align: middle;
}

/* Сортируемые заголовки */
.table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    position: relative;
}

.table th.sortable:hover {
    background-color: #e5e7eb;
}

.table th.sortable:active {
    background-color: #d1d5db;
}

.sort-indicator {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    font-weight: bold;
    color: #4f46e5;
    opacity: 0.8;
}

.table th.sortable::after {
    content: '↕';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
    font-size: 0.8rem;
    transition: opacity 0.2s ease;
}

.table th.sortable:hover::after {
    opacity: 0.6;
}

/* Скрываем стандартный индикатор если есть активная сортировка */
.table th.sortable:has(.sort-indicator)::after {
    display: none;
}

/* Кнопки действий */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-buttons .btn {
    white-space: nowrap;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: #374151;
    margin-bottom: 1rem;
}

/* Загрузка */
.loading-container {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

/* Градиентный спиннер */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
    position: relative;
}

.loading-spinner.gradient {
    background: linear-gradient(45deg, #4f46e5, #7c3aed, #06b6d4, #10b981);
    background-size: 400% 400%;
    animation: spin 1s linear infinite, gradient-shift 2s ease-in-out infinite;
}

.loading-spinner.gradient::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    background: white;
    border-radius: 50%;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Модальные окна */
.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e5e7eb;
    padding: 1.5rem;
}

/* Бейджи */
.badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
}

/* Специальные стили для авансов */
.signature-status {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Login страница */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
}

.login-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.login-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
}

.login-form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    display: block;
}

.login-form .form-control {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.login-form .form-control:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.login-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border: none;
    border-radius: 10px;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
    text-transform: none;
    letter-spacing: 0.025em;
}

.login-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    transform: translateY(-1px);
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.3);
}

.login-btn:active {
    transform: translateY(0);
}

.login-footer {
    padding: 1rem 2rem 2rem;
    text-align: center;
}

.back-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #4f46e5;
    text-decoration: none;
}

.login-form .alert {
    border-radius: 10px;
    border: none;
    margin-bottom: 1.5rem;
}

.login-form .text-danger {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Logout страница */
.logout-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.logout-container {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.logout-icon {
    font-size: 4rem;
    color: #10b981;
    margin-bottom: 1.5rem;
}

/* Мои сессии */
.my-sessions-container {
    padding: 1.5rem;
}

.session-summary {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.summary-item {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.summary-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4f46e5;
}

.summary-label {
    color: #6b7280;
    font-size: 0.85rem;
}

.session-filters {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* Статистика пользователей */
.user-statistics-container {
    padding: 1.5rem;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.header-row h1 {
    color: #1f2937;
    font-weight: 600;
    margin: 0;
}

.user-selector {
    min-width: 250px;
}

.sessions-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.sessions-summary .summary-item {
    flex: 1;
    min-width: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.sessions-summary .summary-label {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sessions-summary .summary-value {
    color: white !important;
    font-size: 2rem !important;
    font-weight: bold !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    margin-top: 0.5rem;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .content {
        padding-top: 0;
    }
    
    /* Переопределяем отступы Bootstrap для мобильных устройств */
    .row {
        margin: 0 !important;
    }
    
    .row > * {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }

    /* Скрываем некоторые столбцы на мобильных устройствах */
    .table th.sortable::after {
        display: none;
    }

    .sort-indicator {
        font-size: 0.7rem;
    }
}

/* Мобильная навигация */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
        justify-content: space-around !important;
        align-items: stretch !important;
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }
    
    .mobile-bottom-nav .nav-item {
        flex: 1 !important;
        text-align: center !important;
        display: flex !important;
        align-items: stretch !important;
        justify-content: center !important;
    }
    
    .mobile-bottom-nav .nav-link {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        text-align: center !important;
    }

    /* Исправление стилей верхней панели на мобильных */
    .top-row.auth {
        background: #f8f9fa !important;
        border-bottom: 1px solid #dee2e6 !important;
        padding: 0.75rem 1rem !important;
    }

    .user-controls {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    .user-name {
        color: #495057 !important;
        font-weight: 600 !important;
        font-size: 1rem !important;
        text-shadow: none !important;
    }
}

/* Скрываем верхнюю панель полностью на мобильных устройствах */
@media (max-width: 768px) {
    .top-row.auth {
        display: none !important;
    }
    
    /* Скрываем панель RFG Master Server на мобильных */
    .top-row.navbar.navbar-dark {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .top-row.auth {
        display: none !important;
    }
    
    /* Скрываем панель RFG Master Server на мобильных */
    .top-row.navbar.navbar-dark {
        display: none !important;
    }
    
    /* Переопределяем отступы Bootstrap для очень маленьких экранов */
    .row {
        margin: 0 !important;
    }
    
    .row > * {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 360px) {
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    /* Переопределяем отступы Bootstrap для экстремально маленьких экранов */
    .row {
        margin: 0 !important;
    }
    
    .row > * {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}