/* Дополнительные стили для виртуальной лаборатории генетики */

/* Анимации и переходы */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Применение анимаций */
.method-card {
    animation: fadeIn 0.6s ease-out;
    animation-fill-mode: both;
}

.method-card:nth-child(1) { animation-delay: 0.1s; }
.method-card:nth-child(2) { animation-delay: 0.2s; }
.method-card:nth-child(3) { animation-delay: 0.3s; }
.method-card:nth-child(4) { animation-delay: 0.4s; }
.method-card:nth-child(5) { animation-delay: 0.5s; }
.method-card:nth-child(6) { animation-delay: 0.6s; }

.family-tree-node {
    animation: slideIn 0.5s ease-out;
    transition: all 0.3s ease;
}

.family-tree-node:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

/* Улучшенные стили для генеалогического древа */
.family-tree-container {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px dashed #cbd5e0;
    position: relative;
}

.family-tree-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25px 25px, rgba(59, 130, 246, 0.1) 2px, transparent 0),
        radial-gradient(circle at 75px 75px, rgba(16, 185, 129, 0.1) 2px, transparent 0);
    background-size: 100px 100px;
    pointer-events: none;
}

.generation {
    position: relative;
    padding: 20px 0;
}

.generation::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background: linear-gradient(to right, transparent, #3b82f6, transparent);
}

.generation:last-child::after {
    display: none;
}

/* Символы для генеалогического древа */
.genetic-symbol {
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Улучшенные цвета для признаков */
.trait-normal {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #22c55e;
    color: #166534;
}

.trait-affected {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border-color: #ef4444;
    color: #991b1b;
}

.trait-carrier {
    background: linear-gradient(135deg, #fffbeb 0%, #fde68a 100%);
    border-color: #f59e0b;
    color: #92400e;
}

.trait-unknown {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-color: #64748b;
    color: #475569;
}

/* Стили для модального окна */
.modal-overlay {
    backdrop-filter: blur(4px);
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    animation: fadeIn 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Стили для протокола */
.protocol-form {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.protocol-preview {
    animation: fadeIn 0.5s ease-out;
}

.protocol-content {
    line-height: 1.8;
    font-size: 14px;
}

.protocol-content h1 {
    border-bottom: 3px solid #3b82f6;
    padding-bottom: 10px;
}

.protocol-content h3 {
    color: #1f2937;
    border-left: 4px solid #3b82f6;
    padding-left: 12px;
}

/* Адаптивные стили */
@media (max-width: 768px) {
    .method-card {
        margin-bottom: 1rem;
    }
    
    .family-tree-node {
        min-width: 100px;
        font-size: 0.875rem;
        padding: 8px;
        margin: 5px;
    }
    
    .genetic-symbol {
        font-size: 1.5rem;
    }
    
    .modal-content {
        margin: 1rem;
        max-height: 85vh;
    }
    
    .protocol-content {
        font-size: 12px;
        line-height: 1.6;
    }
}

@media (max-width: 640px) {
    .family-tree-container {
        padding: 15px;
        min-height: 300px;
    }
    
    .generation {
        padding: 15px 0;
    }
    
    .family-tree-node {
        min-width: 80px;
        font-size: 0.75rem;
        padding: 6px;
        margin: 3px;
    }
    
    .genetic-symbol {
        font-size: 1.25rem;
    }
}

/* Кастомные стили для форм */
.form-input {
    transition: all 0.3s ease;
    border: 2px solid #e2e8f0;
}

.form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.form-select {
    transition: all 0.3s ease;
    border: 2px solid #e2e8f0;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Стили для кнопок */
.btn {
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover:before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Индикатор загрузки */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #10b981;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.notification.error {
    background: #ef4444;
}

.notification.warning {
    background: #f59e0b;
}

.notification.info {
    background: #3b82f6;
}

/* Стили для печати */
@media print {
    body * {
        visibility: hidden;
    }
    
    .protocol-content, .protocol-content * {
        visibility: visible;
    }
    
    .protocol-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white !important;
        box-shadow: none !important;
        border: none !important;
    }
    
    .btn, button, nav, header, footer {
        display: none !important;
    }
}

/* Скрытие элементов для скринридеров */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Фокус для доступности */
*:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Кастомные checkbox */
.custom-checkbox {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.custom-checkbox:checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

.custom-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.custom-checkbox:hover {
    border-color: #3b82f6;
    transform: scale(1.1);
}

/* Стили для тултипов */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #1f2937;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.4;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}