/* Comorbidity Modal and Icon Button Styles */

/* Icon Button in Label */
.icon-btn-inline {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.3);
    vertical-align: middle;
}

.icon-btn-inline:hover {
    background: linear-gradient(135deg, #1565C0, #0D47A1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.5);
}

.icon-btn-inline i {
    font-size: 14px;
}

/* Modal Overlay */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal Content */
.modal-content {
    background-color: #ffffff;
    margin: auto;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    animation: slideIn 0.3s ease;
}

.modal-content.modal-large {
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.modal-header {
    padding: 25px 30px;
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.6em;
    font-weight: 700;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.modal-header h3 .en,
.modal-header h3 .ar {
    color: white !important;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
    padding: 0;
}

.modal-close:hover,
.modal-close:focus {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: 60vh;
}

/* Search Input */
.search-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1em;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.search-input:focus {
    outline: none;
    border-color: #1976D2;
    background: white;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

/* Comorbidity Categories */
.comorbidity-categories {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comorbidity-category {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.comorbidity-category:hover {
    border-color: #1976D2;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.15);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #1976D2;
    cursor: pointer;
    user-select: none;
}

.category-header:hover {
    background: rgba(25, 118, 210, 0.05);
    border-radius: 8px;
    padding: 5px 10px;
    margin: -5px -10px 15px -10px;
}

.category-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #1976D2, #1565C0);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2em;
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.3);
}

.category-title {
    flex: 1;
    font-size: 1.2em;
    font-weight: 700;
    color: #1976D2;
}

.category-toggle {
    width: 28px;
    height: 28px;
    background: #1976D2;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.category-header.collapsed .category-toggle {
    transform: rotate(-90deg);
}

.category-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    padding-top: 10px;
}

.category-items.collapsed {
    display: none;
}

.comorbidity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comorbidity-item:hover {
    border-color: #1976D2;
    background: #f0f7ff;
    transform: translateX(5px);
}

.comorbidity-item.selected {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    border-color: #1565C0;
    color: white;
}

.comorbidity-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #1976D2;
}

.comorbidity-item label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    font-size: 0.95em;
    line-height: 1.4;
}

.comorbidity-item.selected label {
    color: white;
    font-weight: 600;
}

/* Selected Count Badge */
.category-count {
    background: #4CAF50;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

/* Modal Footer */
.modal-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-radius: 0 0 16px 16px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    border-top: 1px solid #e0e0e0;
}

.modal-footer .btn {
    padding: 12px 30px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #4CAF50 0%, #45A049 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.modal-footer .btn-primary:hover {
    background: linear-gradient(135deg, #45A049 0%, #3D8B40 100%);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.5);
    transform: translateY(-2px);
}

.modal-footer .btn-secondary {
    background: #ffffff;
    color: #666;
    border: 2px solid #e0e0e0;
}

.modal-footer .btn-secondary:hover {
    background: #f8f9fa;
    border-color: #1976D2;
    color: #1976D2;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 1.2em;
    margin: 0;
}

/* Loading State */
.loading-spinner {
    text-align: center;
    padding: 40px;
}

.loading-spinner i {
    font-size: 3em;
    color: #1976D2;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-header h3 {
        font-size: 1.3em;
    }

    .modal-body {
        padding: 20px;
        max-height: 50vh;
    }

    .category-items {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        padding: 15px 20px;
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .icon-btn-inline {
        width: 28px;
        height: 28px;
    }

    .icon-btn-inline i {
        font-size: 12px;
    }

    .modal-header h3 {
        font-size: 1.1em;
    }

    .category-title {
        font-size: 1em;
    }

    .comorbidity-item {
        padding: 10px;
    }
}

/* Print Styles */
@media print {
    .modal,
    .icon-btn-inline {
        display: none !important;
    }
}
