/**
 * التصميم الكامل - نظام التغذية الطبي
 * د. سيد فخري
 * الألوان: #7ed0f0, #0b6b93
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #e8f8ff 0%, #f0fcff 100%);
    min-height: 100vh;
    padding: 20px;
    color: #122;
    direction: rtl;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 32px;
    font-weight: 800;
    color: #0b6b93;
    margin-bottom: 8px;
}

.header p {
    font-size: 16px;
    color: #666;
}

.card {
    background: white;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 30px rgba(11, 107, 147, 0.06);
}

.card h2 {
    font-size: 22px;
    font-weight: 700;
    color: #0b6b93;
    margin-bottom: 6px;
}

.card-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    font-size: 15px;
    font-weight: 700;
    color: #122;
    margin-bottom: 8px;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e6f2f8;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Cairo', sans-serif;
    transition: all 0.2s;
}

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

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #7ed0f0;
    box-shadow: 0 0 0 3px rgba(126, 208, 240, 0.1);
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 800;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #7ed0f0;
    color: white;
}

.btn-primary:hover {
    background: #5fc5ed;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(126, 208, 240, 0.4);
}

.btn-secondary {
    background: #e8f8ff;
    color: #0b6b93;
    border: 1px solid #cfeff9;
}

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

.btn-danger {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.btn-danger:hover {
    background: #fdd;
}

.btn-small {
    padding: 10px 16px;
    font-size: 14px;
}

.btn-block {
    width: 100%;
}

.result-panel {
    background: #f0fcff;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.metric-card {
    background: white;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(11, 107, 147, 0.04);
}

.metric-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 800;
    color: #0b6b93;
}

.badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
}

.badge-normal { background: #d1fae5; color: #065f46; }
.badge-underweight { background: #fef3c7; color: #92400e; }
.badge-overweight { background: #fed7aa; color: #9a3412; }
.badge-obese { background: #fecaca; color: #991b1b; }

.meal-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    overflow-x: auto;
    display: block;
}

.meal-table table {
    width: 100%;
    min-width: 600px;
}

.meal-table th {
    background: #f0fcff;
    color: #0b6b93;
    font-weight: 700;
    padding: 12px;
    border: 1px solid #e6f7fb;
    font-size: 14px;
}

.meal-table td {
    padding: 12px;
    border: 1px solid #e6f7fb;
    text-align: center;
    font-size: 14px;
}

.totals-row {
    background: #f0fcff;
    font-weight: 700;
}

.summary-box {
    background: white;
    border-radius: 10px;
    padding: 16px;
    margin-top: 16px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e6f7fb;
}

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

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.patient-list {
    list-style: none;
}

.patient-item {
    background: white;
    border: 1px solid #e6f7fb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.patient-item:hover {
    box-shadow: 0 4px 12px rgba(11, 107, 147, 0.1);
    transform: translateY(-2px);
}

.patient-info h3 {
    font-size: 18px;
    font-weight: 700;
    color: #0b6b93;
    margin-bottom: 4px;
}

.patient-info p {
    font-size: 13px;
    color: #666;
}

.patient-actions {
    display: flex;
    gap: 8px;
}

.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fecaca;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.login-container {
    max-width: 450px;
    margin: 80px auto;
}

.empty-state {
    text-align: center;
    padding: 50px;
    color: #888;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.hidden {
    display: none !important;
}

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

.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.navbar {
    background: white;
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(11, 107, 147, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 20px;
    font-weight: 800;
    color: #0b6b93;
}

.navbar-user {
    font-size: 15px;
    color: #666;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    border: 1px solid #e6f7fb;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: #7ed0f0;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: #666;
}


/* أزرار البدائل التفاعلية */
.btn-replace {
    font-size: 18px;
    font-weight: 700;
    padding: 4px 10px;
    margin-left: 10px;
    background: linear-gradient(135deg, #0b6b93 0%, #7ed0f0 100%);
    border: 2px solid #0b6b93;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(11, 107, 147, 0.3);
    min-width: 40px;
    text-align: center;
}

.btn-replace:hover {
    background: linear-gradient(135deg, #7ed0f0 0%, #0b6b93 100%);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(11, 107, 147, 0.5);
}

.btn-replace:active {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(11, 107, 147, 0.4);
}

.food-cell {
    position: relative;
}

.food-cell select {
    width: 90%;
    padding: 6px;
    font-size: 13px;
    border: 2px solid #0b6b93;
    border-radius: 4px;
    background: white;
    font-family: 'Cairo', sans-serif;
}

