* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 2em;
}

.stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
}

.stats .stat-card {
    flex: 1;
}

#userStatistics {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
}

#userStatistics .stat-card {
    flex: 1;
}

.statistics {
    margin-bottom: 2px;
}

.filters {
    margin-bottom: 2px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    color: white;
}

.stat-card-clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card-clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.stat-card-clickable:active {
    transform: translateY(-1px);
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.filters {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

select {
    padding: 10px 15px;
    border: 2px solid white;
    border-radius: 6px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    color: #4a5568;
}

.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.ticket-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.ticket-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.ticket-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #2d3748;
    flex: 1;
}

.ticket-priority {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

/* Стили для групп */
.priority-gr-2 {
    background: #d6bcfa;
    color: #553c9a;
}

.priority-gr-4 {
    background: #fbb6ce;
    color: #97266d;
}

.priority-gr-8 {
    background: #9ae6b4;
    color: #22543d;
}

.priority-gr-6 {
    background: linear-gradient(135deg, #d6bcfa 0%, #fbb6ce 100%);
    color: #553c9a;
}

.priority-gr-14 {
    background: linear-gradient(135deg, #d6bcfa 0%, #fbb6ce 50%, #9ae6b4 100%);
    color: #2d3748;
}

/* Стили для типов */
.priority-type-0 {
    background: #bee3f8;
    color: #2c5282;
}

.priority-type-1 {
    background: #fbd38d;
    color: #744210;
}

.priority-type-2 {
    background: #fc8181;
    color: #742a2a;
}

.priority-type-3 {
    background: #90cdf4;
    color: #2c5282;
}

.priority-type-4 {
    background: #feb2b2;
    color: #742a2a;
}

.priority-type-5 {
    background: #fbb6ce;
    color: #97266d;
}

.priority-type-6 {
    background: #b2f5ea;
    color: #234e52;
}

.ticket-description {
    color: #4a5568;
    margin-bottom: 15px;
    line-height: 1.5;
}

.ticket-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: #718096;
}

.meta-label {
    font-weight: 600;
}

.ticket-status {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
}

.status-0 {
    background: #bee3f8;
    color: #2c5282;
}

.status-1 {
    background: #fbd38d;
    color: #744210;
}

.status-2 {
    background: #c6f6d5;
    color: #22543d;
}

.ticket-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.ticket-actions .btn {
    flex: 1;
    padding: 8px 16px;
    font-size: 0.9em;
}

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

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

.modal-content {
    background-color: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #000;
}

#modal-title {
    color: #2d3748;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2d3748;
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .tickets-grid {
        grid-template-columns: 1fr;
    }

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

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filters {
        flex-direction: column;
    }
}

/* Дополнительные стили для пользователей */
.badge-admin {
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 18px;
}

a.btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.stat-card-compact {
    padding: 12px 10px;
    min-width: 80px;
}

.stat-card-compact .stat-value {
    font-size: 24px;
}

.stat-card-compact .stat-label {
    font-size: 11px;
    white-space: nowrap;
}

.users-list {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.users-list .ticket-card {
    margin-bottom: 10px;
    border-radius: 8px;
    padding: 15px;
}

.users-list .ticket-card:last-child {
    margin-bottom: 0;
}
