/**
 * Detail Pages & Teams Styles
 * أنماط صفحات التفاصيل والفرق
 *
 * @package Smart_Hospital
 */

/* ========================================
   Detail Page Header
======================================== */
.detail-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.detail-content {
    padding-bottom: 100px;
}

/* ========================================
   Status Banner
======================================== */
.status-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    font-weight: 600;
}

.status-banner.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-banner.status-progress {
    background: #cce5ff;
    color: #004085;
}

.status-banner.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-banner.status-acknowledged {
    background: #d1ecf1;
    color: #0c5460;
}

/* ========================================
   Teams Handoff Card
======================================== */
.teams-handoff-card {
    padding: 24px;
}

.teams-handoff-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.team-block {
    flex: 1;
    text-align: center;
}

.team-label {
    display: block;
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 8px;
}

.team-name-link {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 4px;
}

.team-name-link:hover {
    text-decoration: underline;
}

.team-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
}

.team-dept {
    font-size: 0.85rem;
    color: var(--gray);
}

.handoff-arrow {
    flex-shrink: 0;
    color: var(--primary);
}

.handoff-time-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--light);
    border-radius: var(--radius);
    color: var(--gray);
}

/* ========================================
   Critical Card
======================================== */
.critical-card {
    border-right: 4px solid var(--danger);
}

.critical-title {
    color: var(--danger) !important;
}

.critical-content {
    background: #fff5f5;
    padding: 16px;
    border-radius: var(--radius);
    color: #c0392b;
    line-height: 1.8;
}

/* ========================================
   Tasks List
======================================== */
.tasks-list {
    padding: 0;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--light);
}

.task-item:last-child {
    border-bottom: none;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-light);
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 2px;
}

.task-text {
    flex: 1;
    line-height: 1.6;
}

/* ========================================
   Meta Card
======================================== */
.meta-card {
    background: var(--light);
}

.meta-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.meta-row:last-child {
    border-bottom: none;
}

.meta-label {
    color: var(--gray);
    font-size: 0.9rem;
}

.meta-value {
    font-weight: 500;
}

/* ========================================
   Detail Actions
======================================== */
.detail-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: var(--white);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.status-update-form {
    width: 100%;
}

.btn-success {
    background: var(--secondary);
    color: white;
}

.btn-success:hover {
    background: #05b894;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* ========================================
   Teams Grid
======================================== */
.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.team-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.team-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.team-card.team-inactive {
    opacity: 0.7;
}

.team-card-link {
    display: block;
    padding: 20px;
    text-decoration: none;
    color: var(--dark);
}

.team-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.team-dept-badge {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
}

.team-dept-badge.dept-pt { background: #0077b6; }
.team-dept-badge.dept-ot { background: #00b4d8; }
.team-dept-badge.dept-st { background: #90e0ef; color: var(--dark); }
.team-dept-badge.dept-nursing { background: #e63946; }
.team-dept-badge.dept-nutrition { background: #06d6a0; }
.team-dept-badge.dept-psychology { background: #9b59b6; }
.team-dept-badge.dept-social { background: #f39c12; }
.team-dept-badge.dept-rehab { background: #0077b6; }

.team-shift-badge {
    font-size: 0.75rem;
    color: var(--gray);
}

.team-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.team-leader {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.team-leader img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.team-leader span {
    font-size: 0.9rem;
    color: var(--gray);
}

.team-card-stats {
    display: flex;
    gap: 16px;
}

.team-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--gray);
}

.inactive-badge {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 12px;
    background: var(--light);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--gray);
}

/* ========================================
   Users Quick Select
======================================== */
.users-quick-select {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.user-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-checkbox:has(input:checked) {
    background: var(--primary);
    color: white;
}

.user-checkbox input {
    display: none;
}

.user-checkbox img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* ========================================
   Progress List Styles
======================================== */
.progress-list-item .list-item-link {
    align-items: flex-start;
}

.progress-date-block {
    width: 50px;
    text-align: center;
    background: var(--primary);
    color: white;
    padding: 8px;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.progress-day {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}

.progress-month {
    font-size: 0.7rem;
    text-transform: uppercase;
}

.progress-scores-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.score-badge {
    padding: 4px 10px;
    background: var(--light);
    border-radius: var(--radius);
    font-size: 0.8rem;
}

.score-badge strong {
    color: var(--primary);
}

.pain-badge.pain-level-high {
    background: #ffeaea;
}

.pain-badge.pain-level-high strong {
    color: var(--danger);
}

/* ========================================
   Patient Summary Card
======================================== */
.patient-summary-card {
    background: linear-gradient(135deg, var(--primary) 0%, #00b4d8 100%);
    color: white;
    padding: 24px;
}

.patient-summary-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.patient-avatar-lg {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.patient-summary-info h2 {
    margin-bottom: 4px;
}

.patient-room,
.patient-diagnosis {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
}

.latest-scores {
    display: flex;
    justify-content: space-around;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.score-item {
    text-align: center;
}

.score-item .score-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
}

.score-item .score-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* ========================================
   Progress Chart
======================================== */
.progress-chart-container {
    height: 250px;
    padding: 16px 0;
}

/* ========================================
   Toast Notifications
======================================== */
.toast-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--dark);
    color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-notification.toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-notification.toast-success {
    background: var(--secondary);
}

.toast-notification.toast-error {
    background: var(--danger);
}

/* ========================================
   Form Field Errors
======================================== */
.field-error {
    border-color: var(--danger) !important;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.field-error-msg {
    display: block;
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* ========================================
   Spinner
======================================== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   Filters Section
======================================== */
.filters-section {
    margin-bottom: 16px;
}

.filters-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    padding-left: 36px;
    border: 2px solid var(--light);
    border-radius: var(--radius);
    background: var(--white);
    font-size: 0.9rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 10px center;
    background-size: 18px;
}

.clear-filters {
    padding: 10px 14px;
    color: var(--danger);
    text-decoration: none;
    font-size: 0.9rem;
}

.clear-filters:hover {
    text-decoration: underline;
}

.results-count {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 12px;
    padding: 0 4px;
}

/* ========================================
   Goal Type Badge
======================================== */
.goal-type-badge {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 12px;
    flex-shrink: 0;
}

.type-functional { background: #dbeafe; color: #1e40af; }
.type-mobility { background: #dcfce7; color: #166534; }
.type-cognitive { background: #fef3c7; color: #92400e; }
.type-speech { background: #fce7f3; color: #9d174d; }
.type-nutrition { background: #d1fae5; color: #065f46; }
.type-discharge { background: #e0e7ff; color: #3730a3; }
.type-safety { background: #fee2e2; color: #991b1b; }

/* ========================================
   Responsive Adjustments
======================================== */
@media (max-width: 600px) {
    .teams-handoff-display {
        flex-direction: column;
    }
    
    .handoff-arrow {
        transform: rotate(90deg);
    }
    
    .teams-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-actions {
        padding: 12px 16px;
    }
    
    .toast-notification {
        left: 16px;
        right: 16px;
        transform: translateY(100px);
    }
    
    .toast-notification.toast-show {
        transform: translateY(0);
    }
}
