/*
Theme Name: Smart Hospital App
Theme URI: https://example.com/smart-hospital
Author: Smart Hospital Team
Author URI: https://example.com
Description: قالب ووردبريس احترافي لإدارة المستشفيات والرعاية الصحية - Professional WordPress theme for hospital and healthcare management
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: smart-hospital
Tags: healthcare, medical, hospital, nursing, rtl-language-support, custom-menu, featured-images
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
*/

/* ========================================
   CSS Variables
======================================== */
:root {
    --primary: #0077b6;
    --primary-dark: #005f92;
    --primary-light: #00a8e8;
    --secondary: #10b981;
    --danger: #dc2626;
    --warning: #f59e0b;
    --dark: #1f2937;
    --gray: #6b7280;
    --gray-light: #9ca3af;
    --muted: #6c757d;
    --light: #f3f4f6;
    --white: #ffffff;
    --bg: #e8f4f8;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --transition: all 0.3s ease;
}

/* ========================================
   Reset & Base
======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ========================================
   App Container
======================================== */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
    overflow-x: hidden;
}

@media (min-width: 481px) {
    .app-container {
        margin: 20px auto;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        min-height: calc(100vh - 40px);
    }
}

/* ========================================
   Header
======================================== */
.app-header {
    background: var(--primary);
    padding: 20px 20px 35px;
    border-radius: 0 0 30px 30px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    overflow: hidden;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar svg {
    color: white;
    opacity: 0.8;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
}

.app-title {
    color: white;
    font-size: 1rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.2);
}

.icon-btn .icon-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.icon-btn .badge-warning {
    background: #ef4444;
}

.alert-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    color: white;
    text-decoration: none;
    font-weight: 600;
    line-height: 1;
    transition: var(--transition);
}

.alert-chip svg {
    background: rgba(255,255,255,0.12);
    padding: 6px;
    border-radius: 50%;
}

.alert-chip .chip-text {
    white-space: nowrap;
}

.alert-chip:hover {
    background: rgba(255,255,255,0.25);
}

.infection-chip {
    background: #fee2e2;
    color: #991b1b;
}

.infection-chip svg {
    background: #fecaca;
    color: #b91c1c;
}

.infection-chip:hover {
    background: #fecaca;
}

.page-title {
    color: white;
    font-size: 2rem;
    font-weight: 700;
}

/* ========================================
   Main Content
======================================== */
.app-content {
    padding: 20px;
    margin-top: -15px;
    padding-bottom: 100px;
}

/* ========================================
   Cards
======================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

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

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
}

.card-link {
    color: var(--gray);
    font-size: 0.9rem;
    transition: var(--transition);
}

.card-link:hover {
    color: var(--primary);
}

/* ========================================
   Critical Alerts
======================================== */
.alerts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.alert-item {
    background: var(--danger);
    color: white;
    padding: 16px;
    border-radius: var(--radius);
    transition: var(--transition);
    display: block;
}

.alert-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.alert-name {
    font-weight: 700;
    font-size: 1rem;
    display: block;
    margin-bottom: 4px;
}

.alert-info {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* ========================================
   Tasks Section
======================================== */
.tasks-card {
    background: var(--light);
    border: 1px solid #e5e7eb;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--gray);
}

.progress-bar {
    height: 8px;
    background: #d1d5db;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    padding: 4px 0;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    background: transparent;
}

.task-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}

.task-checkbox svg {
    opacity: 0;
    color: white;
    transition: var(--transition);
}

.task-checkbox.checked svg {
    opacity: 1;
}

.task-label {
    font-size: 1rem;
    color: var(--dark);
    transition: var(--transition);
}

.task-label.completed {
    color: var(--gray);
    text-decoration: line-through;
}

/* ========================================
   Patient Overview
======================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
}

.patients-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.patients-scroll::-webkit-scrollbar {
    display: none;
}

.patient-card {
    flex-shrink: 0;
    width: 120px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    box-shadow: var(--shadow);
    scroll-snap-align: start;
    transition: var(--transition);
    display: block;
}

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

.patient-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dark);
    margin-bottom: 8px;
    line-height: 1.3;
}

.patient-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-stable {
    background: #dcfce7;
    color: #16a34a;
}

.status-critical,
.status-unstable {
    background: #fee2e2;
    color: #dc2626;
}

.status-recovering {
    background: #fef3c7;
    color: #d97706;
}

/* ========================================
   AI Assistant Button
======================================== */
.ai-assistant-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 440px;
    background: var(--primary);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-full);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 119, 182, 0.4);
    transition: var(--transition);
    z-index: 100;
    text-decoration: none;
}

.ai-assistant-btn:hover {
    background: var(--primary-dark);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 119, 182, 0.5);
}

.ai-assistant-btn svg {
    flex-shrink: 0;
}

/* ========================================
   Buttons
======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
}

.btn-secondary:hover {
    background: #e5e7eb;
}

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

.btn-block {
    width: 100%;
}

/* ========================================
   Forms
======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--light);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

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

/* ========================================
   Empty State
======================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state svg {
    color: var(--gray-light);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--dark);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray);
    font-size: 0.95rem;
}

/* ========================================
   Animations
======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.4s ease forwards;
}

.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }

/* ========================================
   Scrollbar
======================================== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 2px;
}

/* ========================================
   Utilities
======================================== */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-gray { color: var(--gray); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.hidden { display: none; }
