html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a, .btn-link {
    color: #667eea;
    transition: all 0.3s ease;
}

a:hover, .btn-link:hover {
    color: #764ba2;
    text-decoration: none;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(245, 87, 108, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    border: none;
    border-radius: 8px;
    color: #333;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(250, 112, 154, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(250, 112, 154, 0.4);
    color: #333;
}

.btn-secondary {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border: none;
    border-radius: 8px;
    color: #333;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    color: #333;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    border-color: #667eea;
}

.content {
    padding-top: 1.1rem;
}

h1:focus, h2:focus {
    outline: none;
}

h1, h2, h3, h4, h5, h6 {
    color: #2d3748;
    font-weight: 600;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
    border-color: #26b050;
}

.invalid {
    outline: 1px solid #e50000;
    border-color: #e50000;
}

.validation-message {
    color: #e50000;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Современные стили для форм */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

/* Стили для таблиц */
.table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    background: white;
    margin-bottom: 0;
}

.table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.table thead th {
    border: none;
    padding: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background-color: #f7fafc;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-color: #e2e8f0;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #f8f9fa;
}

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

.table-danger {
    background-color: #fff5f5 !important;
    border-left: 4px solid #fc8181;
}

.table-danger:hover {
    background-color: #ffe5e5 !important;
}

/* Мобильные карточки вместо таблиц */
@media (max-width: 768px) {
    .table-responsive {
        overflow: visible;
    }
    
    .table, .table thead, .table tbody, .table th, .table td, .table tr {
        display: block;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        background: white;
        border-radius: 10px;
        padding: 0.75rem 0.6rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        transition: all 0.3s ease;
    }
    
    .table tbody tr:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    }
    
    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0.5rem;
        border: none;
        border-bottom: 1px solid #e2e8f0;
        text-align: right;
        font-size: 0.9rem;
    }
    
    .table tbody td:last-child {
        border-bottom: none;
        padding-top: 0.75rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        flex-direction: row;
        gap: 0.5rem;
        justify-content: stretch;
    }
    
    .table tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #667eea;
        text-align: left;
        flex: 0 0 32%;
        margin-right: 0.5rem;
        font-size: 0.85rem;
    }
    
    .table tbody td:last-child:before {
        display: none;
    }
    
    .table tbody td:last-child {
        justify-content: stretch;
    }
    
    .table tbody td .btn {
        flex: 1;
        margin: 0;
        min-width: 0;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .table tbody td .btn .bi {
        margin-right: 0.25rem;
        font-size: 0.9rem;
    }
    
    .table tbody td .d-none {
        display: none !important;
    }
    
    /* Компактные карточки для очень маленьких экранов */
    @media (max-width: 480px) {
        .table tbody tr {
            margin-bottom: 0.75rem;
            padding: 0.6rem 0.5rem;
        }
        
        .table tbody td {
            padding: 0.4rem 0.4rem;
            font-size: 0.85rem;
        }
        
        .table tbody td:before {
            flex: 0 0 30%;
            font-size: 0.8rem;
        }
        
        .table tbody td:last-child {
            padding-top: 0.5rem;
            padding-left: 0.4rem;
            padding-right: 0.4rem;
            flex-direction: column;
            gap: 0.4rem;
        }
        
        .table tbody td .btn {
            width: 100%;
            padding: 0.5rem;
        }
    }
}

/* Модальные окна */
.modal {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
    background: white;
}

.modal-footer {
    border: none;
    padding: 1.5rem;
    background: #f8f9fa;
    display: flex;
    gap: 0.75rem;
}

.btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.9;
    transition: all 0.3s ease;
}

.btn-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 15px;
        animation: slideUpMobile 0.3s ease;
    }
    
    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
}

/* Алерты */
.alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.alert-info {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #2d3748;
    font-weight: 500;
}

@media (max-width: 768px) {
    .alert {
        padding: 0.875rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* Спиннеры */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
    color: #667eea;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

.text-center {
    padding: 2rem 0;
}

/* Контейнеры */
.container {
    max-width: 1200px;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch !important;
    }
    
    .d-flex.justify-content-between .btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    .table tbody tr {
        margin-bottom: 1.25rem;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .modal-dialog {
        margin: 0.75rem;
        max-width: calc(100% - 1.5rem);
    }
    
    .form-control, .form-select {
        font-size: 16px; /* Предотвращает зум на iOS */
    }
}

/* Дополнительные улучшения для очень маленьких экранов */
@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .table tbody td {
        font-size: 0.9rem;
        padding: 0.5rem 0;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.6rem 0.9rem;
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding: 0.75rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0y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IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}