/* ICF Web Browser Styles */

/* Tree indentation classes */
.ml-0 { margin-left: 0rem; }
.ml-4 { margin-left: 1rem; }
.ml-8 { margin-left: 2rem; }
.ml-12 { margin-left: 3rem; }
.ml-16 { margin-left: 4rem; }
.ml-20 { margin-left: 5rem; }
.ml-24 { margin-left: 6rem; }
.ml-28 { margin-left: 7rem; }
.ml-32 { margin-left: 8rem; }

/* Focus ring for better accessibility */
.focus-ring:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Custom scrollbar for tree view */
.icf-tree-scroll::-webkit-scrollbar {
    width: 8px;
}

.icf-tree-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.icf-tree-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.icf-tree-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animation for tree node expansion */
.tree-node {
    transition: all 0.2s ease-in-out;
}

.tree-node:hover {
    background-color: #f8fafc;
}

.tree-node.selected {
    background-color: #dbeafe;
    border-left: 4px solid #2563eb;
}

.tree-node.excluded {
    opacity: 0.6;
    text-decoration: line-through;
}

/* Template editor styling */
.template-editor {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* Storage dialog overlay */
.storage-dialog-overlay {
    backdrop-filter: blur(2px);
}

/* Button states */
.btn-primary {
    background-color: #2563eb;
    color: white;
    transition: background-color 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.btn-primary:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* Loading animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Tab navigation */
.tab-active {
    border-bottom: 2px solid #2563eb;
    color: #2563eb;
    background-color: #dbeafe;
}

.tab-inactive {
    color: #6b7280;
    transition: color 0.2s, background-color 0.2s;
}

.tab-inactive:hover {
    color: #374151;
    background-color: #f9fafb;
}

/* ICF code highlighting */
.icf-code-highlight {
    background-color: #fef3c7;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* Rating controls */
.rating-section {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 16px;
    background-color: #f9fafb;
}

.rating-section h4 {
    color: #374151;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
}

.status-success {
    color: #059669;
}

.status-warning {
    color: #d97706;
}

.status-error {
    color: #dc2626;
}

/* Template preview */
.template-preview-container {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.template-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Questionnaire styling */
.questionnaire-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
}

.questionnaire-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

/* Form styling */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Utility classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Mobile ICF Tab Enhancements */
.mobile-nav-tab {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-tab:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.mobile-tree-button {
    touch-action: manipulation;
    min-height: 32px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-tree-button:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Touch-optimized textarea */
.mobile-textarea {
    -webkit-appearance: none;
    resize: none;
    font-size: 16px; /* Prevents zoom on iOS */
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    /* Improved mobile layout */
    .icf-main-layout {
        flex-direction: column;
    }
    
    .icf-tree-panel {
        width: 100%;
        height: 300px;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .icf-detail-panel {
        flex: 1;
    }
    
    /* Better mobile spacing */
    .mobile-compact-padding {
        padding: 0.75rem;
    }
    
    /* Larger touch targets on mobile */
    .mobile-touch-target {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Pflegegrad Calculator Styles */
.pflegegrad-module {
    transition: all 0.3s ease;
}

.pflegegrad-module:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pflegegrad-question {
    transition: all 0.2s ease;
}

.pflegegrad-question:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pflegegrad-question.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.pflegegrad-comment-toggle {
    transition: all 0.2s ease;
    font-weight: 500;
}

.pflegegrad-comment-toggle:hover {
    transform: translateY(-1px);
}

.pflegegrad-comment-box {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        margin-top: 0;
    }
    to {
        opacity: 1;
        max-height: 120px;
        margin-top: 8px;
    }
}

.pflegegrad-result-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #0ea5e9;
}

.pflegegrad-result-highlight {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-left: 4px solid #16a34a;
}

.pflegegrad-module-score {
    transition: all 0.2s ease;
}

.pflegegrad-module-score:hover {
    background-color: #f1f5f9;
}

/* Radio button styling for Pflegegrad questions */
.pflegegrad-radio {
    position: relative;
}

.pflegegrad-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.pflegegrad-radio .radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    background: white;
    transition: all 0.2s ease;
    display: inline-block;
    vertical-align: top;
    margin-top: 2px;
}

.pflegegrad-radio input[type="radio"]:checked + .radio-custom {
    border-color: #2563eb;
    background: #2563eb;
    box-shadow: inset 0 0 0 3px white;
}

.pflegegrad-radio:hover .radio-custom {
    border-color: #6b7280;
}

.pflegegrad-radio input[type="radio"]:checked:hover + .radio-custom {
    border-color: #1d4ed8;
    background: #1d4ed8;
}

/* Age input styling */
.pflegegrad-age-input {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px solid #93c5fd;
    transition: all 0.2s ease;
}

.pflegegrad-age-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}

/* Progress indicators */
.pflegegrad-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.pflegegrad-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Comment indicator */
.pflegegrad-comment-indicator {
    position: relative;
}

.pflegegrad-comment-indicator::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pflegegrad-comment-indicator.has-comment::after {
    opacity: 1;
}

/* Frequency input styling */
.pflegegrad-frequency-input {
    text-align: center;
    font-weight: 600;
    color: #1f2937;
}

.pflegegrad-frequency-input:focus {
    background: #fef3c7;
    border-color: #f59e0b;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-break {
        page-break-after: always;
    }
    
    .pflegegrad-module {
        break-inside: avoid;
        box-shadow: none;
    }
    
    .pflegegrad-question {
        break-inside: avoid;
        box-shadow: none;
    }
}