/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --success-color: #4CAF50;
    --info-color: #2196F3;
    --dark-color: #333;
    --light-color: #f5f5f5;
    --border-color: #ddd;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #fafafa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Навигация */
.navbar {
    background: white;
    box-shadow: var(--shadow);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-user {
    color: var(--dark-color);
    font-weight: 500;
}

/* Основной контент */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Футер */
.footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
    color: #666;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #0b7dda;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* Формы */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

textarea.form-control {
    resize: vertical;
}

/* Чекбоксы и радио */
.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 0;
}

.checkbox-label input,
.radio-label input {
    margin-right: 0.5rem;
    cursor: pointer;
}

/* Алерты */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    position: relative;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-close {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* Карточки */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.card h2 {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.card-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Страница входа */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.login-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: #666;
}

/* Дашборд */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    color: var(--dark-color);
}

.surveys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.survey-card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.survey-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.survey-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.survey-card-header h3 {
    margin: 0;
    color: var(--dark-color);
    flex: 1;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-secondary {
    background: #e9ecef;
    color: #6c757d;
}

.survey-description {
    color: #666;
    margin-bottom: 1rem;
}

.survey-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.875rem;
    color: #666;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.survey-link {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.survey-link input {
    flex: 1;
    font-size: 0.875rem;
}

.survey-card-footer {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.survey-card-meta {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

/* Редактор опроса */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    margin: 0;
}

.survey-edit-container {
    max-width: 900px;
    margin: 0 auto;
}

.question-form {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.question-form h3 {
    margin-bottom: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
}

.questions-list {
    margin-top: 1.5rem;
}

.question-item {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
}

.question-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.question-number {
    background: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.question-type-badge {
    background: #e9ecef;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
}

.required-badge {
    background: #fff3cd;
    color: #856404;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
}

.question-content {
    margin: 1rem 0;
}

.question-options {
    margin-left: 2rem;
    color: #666;
}

.question-actions {
    display: flex;
    gap: 0.5rem;
}

/* Результаты */
.results-container {
    max-width: 1200px;
    margin: 0 auto;
}

.table-responsive {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.results-table th,
.results-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.results-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--dark-color);
}

.results-table tbody tr:hover {
    background: #f8f9fa;
}

.response-details {
    background: #fafafa !important;
}

.response-details-content {
    padding: 1rem;
}

.answer-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.answer-item:last-child {
    border-bottom: none;
}

.answer-item strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.answer-item p {
    margin: 0;
    color: #666;
}

/* Публичные страницы */
.public-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 2rem 0;
}

.public-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 20px;
}

.survey-card-public {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 3rem;
}

.survey-card-public h1 {
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.survey-card-public .survey-description {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.question-block {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.question-block:last-of-type {
    border-bottom: none;
}

.question-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.required {
    color: var(--danger-color);
}

.radio-group, .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.text-input-with-mic {
    position: relative;
}

.mic-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mic-button:hover {
    background: var(--primary-color);
    color: white;
}

.mic-button.recording {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.mic-icon {
    font-size: 1.2rem;
}

.recording-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #fff3cd;
    border-radius: 4px;
    color: #856404;
}

.recording-indicator {
    width: 12px;
    height: 12px;
    background: var(--danger-color);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.thanks-card, .error-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 4rem 3rem;
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--success-color);
    color: white;
    font-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
}

.error-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--warning-color);
    color: white;
    font-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
}

.thanks-card h1, .error-card h1 {
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.text-muted {
    color: #666;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--dark-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger-color);
}

/* Описания с сохранением форматирования */
.survey-description,
.question-description {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
}

.question-description {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid var(--info-color);
}

.question-description-preview {
    color: #666;
    font-size: 0.9rem;
    white-space: pre-wrap;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fff;
    border-radius: 4px;
    border: 1px dashed var(--border-color);
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #888;
}

/* Настройки шкалы в админке */
.scale-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.scale-settings > div {
    flex: 1;
    min-width: 100px;
}

.scale-preview {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

/* Да/Нет вопрос */
.yesno-group {
    display: flex;
    gap: 1rem;
}

.yesno-label {
    flex: 1;
    max-width: 150px;
}

.yesno-label input {
    display: none;
}

.yesno-btn {
    display: block;
    padding: 1rem 2rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.yesno-btn.yes:hover,
.yesno-label input:checked + .yesno-btn.yes {
    background: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

.yesno-btn.no:hover,
.yesno-label input:checked + .yesno-btn.no {
    background: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

/* Рейтинг (звезды) */
.rating-group {
    display: flex;
    gap: 0.25rem;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.rating-label {
    cursor: pointer;
}

.rating-label input {
    display: none;
}

.rating-label .star {
    font-size: 2rem;
    color: #ddd;
    transition: color 0.2s ease;
}

.rating-label:hover .star,
.rating-label:hover ~ .rating-label .star,
.rating-label input:checked ~ .star,
.rating-label input:checked + .star {
    color: #ffc107;
}

.rating-group:hover .rating-label .star {
    color: #ddd;
}

.rating-group .rating-label:hover .star,
.rating-group .rating-label:hover ~ .rating-label .star {
    color: #ffc107;
}

.rating-label input:checked ~ .star {
    color: #ffc107;
}

/* Шкала */
.scale-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.scale-label-text {
    font-size: 0.9rem;
    color: #666;
    min-width: 80px;
}

.scale-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.scale-option {
    cursor: pointer;
}

.scale-option input {
    display: none;
}

.scale-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    font-weight: 500;
    transition: all 0.2s ease;
}

.scale-option:hover .scale-number {
    border-color: var(--primary-color);
    background: rgba(76, 175, 80, 0.1);
}

.scale-option input:checked + .scale-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Шкала Лайкерта */
.likert-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.likert-label {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.likert-label:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.likert-label input {
    margin-right: 1rem;
}

.likert-label input:checked + .likert-text {
    font-weight: 600;
    color: var(--primary-color);
}

.likert-text {
    flex: 1;
}

/* Бейджи типов вопросов */
.badge-rating,
.badge-scale,
.badge-likert {
    background: #fff3cd;
    color: #856404;
}

.badge-yesno {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-date,
.badge-time {
    background: #e2e3e5;
    color: #383d41;
}

.badge-number,
.badge-email {
    background: #d4edda;
    color: #155724;
}

/* Адаптивность */
@media (max-width: 768px) {
    .surveys-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header,
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .survey-card-public {
        padding: 2rem 1.5rem;
    }
    
    .login-card {
        padding: 2rem;
    }
    
    .scale-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .scale-options {
        width: 100%;
        justify-content: center;
    }
    
    .yesno-group {
        flex-direction: column;
    }
    
    .yesno-label {
        max-width: none;
    }
    
    .likert-group {
        font-size: 0.9rem;
    }
}

