/* ==============================================
   Surgical Checklist Styles
   ============================================== */

/* Checklist Progress Bar */
.checklist-progress-bar {
    background: var(--surface);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-track {
    width: 100%;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 10px;
    transition: width 0.3s ease, background 0.3s ease;
}

/* Checklist Container */
.checklist-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Checklist Tabs */
.checklist-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.checklist-tab {
    background: var(--surface);
    border: 2px solid var(--border);
    border-bottom: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    position: relative;
}

.checklist-tab span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checklist-tab:hover {
    background: var(--surface-alt);
    transform: translateY(-2px);
}

.checklist-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.checklist-tab i {
    font-size: 1.1rem;
}

/* Progress Badge on Tab */
.progress-badge {
    display: inline-block;
    background: #f59e0b;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

.critical-indicator {
    display: inline-block;
    background: #ef4444;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 0.3rem;
}

/* Checklist Content */
.checklist-content {
    min-height: 400px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Phase Header */
.checklist-phase-header {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.checklist-phase-header i {
    font-size: 2rem;
    color: var(--primary-color);
}

.checklist-phase-header h2 {
    margin: 0;
    color: var(--text-primary);
}

.safety-header {
    background: #fee2e2;
}

[data-theme="dark"] .safety-header {
    background: #7f1d1d;
}

/* Safety Warning */
.safety-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

[data-theme="dark"] .safety-warning {
    background: #78350f;
    border-left-color: #fbbf24;
}

.safety-warning i {
    color: #f59e0b;
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.safety-warning p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Checklist Section */
.checklist-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 2px solid var(--border);
}

.checklist-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

/* Checklist Items */
.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checklist-item {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.checklist-item:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.checklist-item.critical {
    border-left: 4px solid #f59e0b;
}

.checklist-item.completed {
    background: #d1fae5;
    border-color: #10b981;
}

[data-theme="dark"] .checklist-item.completed {
    background: #064e3b;
    border-color: #10b981;
}

.checklist-item label {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    cursor: pointer;
    width: 100%;
}

.checklist-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Custom Checkbox */
.checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 6px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s ease;
    background: var(--background);
    margin-top: 2px;
}

.checklist-item input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checklist-item input[type="checkbox"]:checked + .checkbox-custom::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    font-weight: bold;
}

.item-text {
    flex: 1;
    color: var(--text-primary);
    line-height: 1.6;
}

.checklist-item.completed .item-text {
    color: #059669;
    font-weight: 500;
}

[data-theme="dark"] .checklist-item.completed .item-text {
    color: #34d399;
}

/* Critical Badge */
.critical-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #fef3c7;
    color: #92400e;
    padding: 0.3rem 0.7rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    margin-left: auto;
}

[data-theme="dark"] .critical-badge {
    background: #78350f;
    color: #fef3c7;
}

.critical-badge i {
    font-size: 0.85rem;
}

/* Checklist Actions */
.checklist-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding-top: 1rem;
    border-top: 2px solid var(--border);
    flex-wrap: wrap;
}

.checklist-actions .btn {
    min-width: 150px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .checklist-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 1rem;
    }
    
    .checklist-tab {
        flex-shrink: 0;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .checklist-tab span {
        flex-direction: column;
        gap: 0.2rem;
        text-align: center;
    }
    
    .progress-badge,
    .critical-indicator {
        position: static;
        margin-left: 0;
        margin-top: 0.2rem;
    }
    
    .checklist-content {
        max-height: 50vh;
    }
    
    .checklist-item label {
        gap: 0.75rem;
    }
    
    .item-text {
        font-size: 0.95rem;
    }
    
    .critical-badge {
        margin-left: 0;
        margin-top: 0.5rem;
        align-self: flex-start;
    }
    
    .checklist-actions {
        flex-direction: column;
    }
    
    .checklist-actions .btn {
        width: 100%;
    }
}

/* Dark Theme */
[data-theme="dark"] .checklist-section {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .checklist-item {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .checklist-item:hover {
    border-color: var(--primary-light);
}

[data-theme="dark"] .checkbox-custom {
    background: #0f172a;
    border-color: #475569;
}

/* Print Styles */
@media print {
    .checklist-tabs,
    .checklist-actions,
    .modal-header button,
    .checklist-progress-bar {
        display: none !important;
    }
    
    .checklist-content {
        max-height: none !important;
        overflow: visible !important;
    }
    
    .checklist-section {
        page-break-inside: avoid;
        border: 1px solid #000;
        margin-bottom: 1rem;
    }
    
    .checklist-item {
        page-break-inside: avoid;
        border: 1px solid #ccc;
        padding: 0.5rem;
    }
    
    .checkbox-custom {
        border: 2px solid #000;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
    
    .checklist-item input[type="checkbox"]:checked + .checkbox-custom {
        background: #000;
        border-color: #000;
    }
    
    .checklist-item input[type="checkbox"]:checked + .checkbox-custom::after {
        color: #fff;
    }
    
    .critical-badge {
        border: 1px solid #000;
        background: #fff;
        color: #000;
    }
    
    .checklist-phase-header {
        border: 2px solid #000;
        margin-bottom: 1rem;
    }
}

/* Animation for completed items */
@keyframes checkAnimation {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.checklist-item input[type="checkbox"]:checked + .checkbox-custom::after {
    animation: checkAnimation 0.3s ease;
}

/* Scrollbar styling */
.checklist-content::-webkit-scrollbar {
    width: 8px;
}

.checklist-content::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 4px;
}

.checklist-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.checklist-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}
