* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

/* Двухколоночный макет */
.app {
    display: flex;
    min-height: 100vh;
}

/* Боковая панель */
.sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #eaeaea;
    padding: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

/* Основной контент */
.main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Сетка записей */
.recordings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Карточка записи */
.recording-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #eaeaea;
    transition: all 0.2s;
    position: relative;
}

.recording-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.recording-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.recording-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    flex: 1;
}

.recording-title:hover {
    color: #007aff;
}

.recording-date {
    font-size: 11px;
    color: #8e8e93;
    margin-bottom: 8px;
}

.recording-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.recording-tag {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.recording-tag:hover {
    background: #007aff;
    color: white;
}

.recording-comment {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 13px;
    color: #666;
    border-left: 3px solid #007aff;
}

audio {
    width: 100%;
    margin: 10px 0;
    border-radius: 6px;
}

.recording-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* Панель записи */
.recorder-panel {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 24px;
    border: 1px solid #eaeaea;
}

.timer {
    font-size: 32px;
    font-family: monospace;
    font-weight: 500;
    margin-bottom: 15px;
    color: #2c3e50;
}

/* Фильтры */
.filter-section {
    margin-bottom: 24px;
}

.filter-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #666;
}

.filter-group input, .filter-group select, .filter-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.filter-group textarea {
    resize: vertical;
    min-height: 60px;
}

.date-range {
    display: flex;
    gap: 8px;
}

.date-range input {
    flex: 1;
}

.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-filter-item {
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-filter-item.active {
    background: #007aff;
    color: white;
}

/* Модальное окно редактирования */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 450px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    cursor: pointer;
    font-size: 24px;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #007aff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #005fc9;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.btn-secondary:hover {
    background: #dee2e6;
}

.btn-danger {
    background: #ff3b30;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #e31e12;
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.stats {
    font-size: 12px;
    color: #666;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eaeaea;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #8e8e93;
    background: white;
    border-radius: 12px;
    grid-column: 1 / -1;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 6px 10px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.page-btn.active {
    background: #007aff;
    color: white;
    border-color: #007aff;
}

/* Транскрипция */
.recording-transcription {
    background: #f8f9fa;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #eaeaea;
    overflow: hidden;
}

.transcription-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f1f3f5;
    font-weight: 500;
    font-size: 13px;
    color: #495057;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.transcription-header:hover {
    background: #e9ecef;
}

.transcription-toggle {
    font-size: 10px;
    color: #868e96;
    transition: transform 0.2s;
}

.transcription-badge {
    margin-left: auto;
    font-size: 11px;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 12px;
    color: #666;
    font-weight: normal;
}

.transcription-content {
    padding: 12px;
    border-top: 1px solid #eaeaea;
}

.transcription-text {
    font-size: 13px;
    line-height: 1.5;
    color: #495057;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Конспект */
.recording-summary {
    background: #e8f0fe;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #c7e0ff;
    overflow: hidden;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #d4e4fc;
    font-weight: 500;
    font-size: 13px;
    color: #0056b3;
    cursor: pointer;
}

.summary-toggle {
    font-size: 10px;
}

.summary-content {
    padding: 12px;
}

.summary-text {
    font-size: 13px;
    line-height: 1.5;
    color: #1a1a1a;
    white-space: pre-wrap;
}

/* Область загрузки файла */
.file-drop-area.drag-over {
    border-color: #007aff;
    background: #e8f0fe;
}

/* МОБИЛЬНАЯ АДАПТАЦИЯ */
@media (max-width: 768px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid #eaeaea;
        padding: 16px;
    }

    .main {
        padding: 16px;
    }

    .recordings-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .recording-card {
        padding: 12px;
    }

    .recorder-panel {
        padding: 16px;
        margin-bottom: 20px;
    }

    .timer {
        font-size: 28px;
    }

    .recording-actions {
        flex-wrap: wrap;
    }

    .recording-actions .btn {
        flex: 1;
        min-width: 80px;
    }

    .filter-section {
        margin-bottom: 20px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }

    .date-range {
        flex-direction: column;
        gap: 8px;
    }

    .date-range input {
        width: 100%;
    }

    .btn {
        padding: 10px 16px;
        font-size: 15px;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }

    .stats {
        font-size: 11px;
    }

    .transcription-header, .summary-header {
        font-size: 12px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding: 12px;
    }

    .main {
        padding: 12px;
    }

    .timer {
        font-size: 24px;
    }

    .recording-title {
        font-size: 14px;
    }

    .recording-comment {
        font-size: 12px;
        padding: 6px 10px;
    }
}


/* Модальное окно управления пользователями */
.user-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.user-modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 500px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.user-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eaeaea;
}

.user-modal-header h3 {
    margin: 0;
    color: #333;
}

.user-modal-close {
    cursor: pointer;
    font-size: 24px;
    color: #999;
}

.user-modal-close:hover {
    color: #333;
}

.user-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.user-item:hover {
    background: #f8f9fa;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 500;
    color: #333;
}

.user-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 4px;
}

.user-role.admin {
    background: #e3f2fd;
    color: #007aff;
}

.user-role.manager {
    background: #fff3e0;
    color: #ff9800;
}

.user-username {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.btn-danger-sm {
    background: #ff3b30;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.btn-danger-sm:hover {
    background: #e31e12;
}

.btn-success-sm {
    background: #4caf50;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.btn-success-sm:hover {
    background: #45a049;
}

.form-group-inline {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.form-group-inline input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.user-modal-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
}

.user-modal-footer h4 {
    margin-bottom: 12px;
    font-size: 14px;
    color: #666;
}

.tag-filter-item {
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tag-filter-item:hover {
    background: #e0e0e0;
}

.tag-filter-item.active {
    background: #007aff;
    color: white;
}

.tag-filter-item.active .delete-tag {
    color: white;
}

.delete-tag {
    cursor: pointer;
    font-size: 12px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.delete-tag:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Стили для вкладок */
.tabs-container {
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    gap: 4px;
    background: #f0f0f0;
    border-radius: 12px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
}

.tab-btn.active {
    background: white;
    color: #007aff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .tab-btn {
        font-size: 11px;
        padding: 8px 6px;
    }
}