/* ============================================
   بوابة المريض — تنسيق جمالي
   ============================================ */

.portal-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 40%, #0d9488 100%);
    padding: 24px;
}

.portal-wrap {
    width: 100%;
    max-width: 520px;
}

.portal-container {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    padding: 36px 32px;
    backdrop-filter: blur(10px);
}

.portal-brand {
    text-align: center;
    margin-bottom: 28px;
}

.portal-brand-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    opacity: 0.95;
}

.portal-title {
    margin: 0 0 6px;
    font-size: 1.65rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.portal-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: #64748b;
}

.portal-alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.portal-alert--danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

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

.portal-form {}
.portal-form-group { margin-bottom: 20px; }
.portal-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #334155;
    font-size: 0.95rem;
}

.portal-optional {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.85rem;
}

.portal-qr-section input { font-family: monospace; font-size: 0.95rem; }
.portal-divider { text-align: center; color: #94a3b8; font-size: 0.9rem; margin: 16px 0; }

.portal-form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.portal-form-group input:focus,
.portal-form-group textarea:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.portal-form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.portal-btn {
    width: 100%;
    margin-top: 8px;
    padding: 16px;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.portal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.4);
}

/* مرحباً بالداخل */
.portal-welcome {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.portal-welcome-text {
    margin: 0 0 4px;
    font-size: 1.2rem;
    color: #065f46;
}

.portal-welcome-code {
    margin: 0;
    font-size: 0.9rem;
    color: #047857;
}

.portal-welcome-code code {
    background: rgba(255,255,255,0.7);
    padding: 2px 8px;
    border-radius: 6px;
}

.portal-section {
    margin-bottom: 24px;
}

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

.portal-section-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
}

.portal-search-form {
    display: flex;
    gap: 8px;
}

.portal-search-form input {
    min-width: 180px;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    background: #f8fafc;
}

.portal-search-form input:focus {
    outline: none;
    border-color: #0d9488;
}

.portal-search-form button {
    padding: 10px 18px;
    background: #0d9488;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

.portal-empty {
    text-align: center;
    padding: 40px 24px;
    color: #64748b;
}

.portal-empty-icon {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.6;
}

/* بطاقات الطلبات */
.portal-orders {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-order-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.portal-order-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.portal-order-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
}

.portal-order-num {
    font-weight: 700;
    color: #1e293b;
}

.portal-order-date {
    font-size: 0.9rem;
    color: #64748b;
}

.portal-order-tests {
    font-size: 0.9rem;
    color: #475569;
}

.portal-order-action {
    padding: 10px 18px;
    background: #0d9488;
    color: #fff !important;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, transform 0.2s;
}

.portal-order-action:hover {
    background: #0f766e;
    transform: translateY(-1px);
}

.portal-footer-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.portal-footer-link {
    color: #0d9488;
    font-weight: 600;
    text-decoration: none;
}

.portal-footer-link:hover {
    text-decoration: underline;
}

.portal-footer-btn {
    background: none;
    border: none;
    color: #0d9488;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
}

.portal-footer-btn:hover {
    text-decoration: underline;
}

/* طلب زيارة منزلية — تخطيط قياسي عمودي */
.home-visit-form .portal-brand { margin-bottom: 28px; }
.home-visit-form-inner { max-width: 480px; margin: 0 auto; }
.home-visit-form .portal-form-group { margin-bottom: 20px; }
.home-visit-form .portal-form-group:last-of-type { margin-bottom: 0; }
.home-visit-time-inputs { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.home-visit-time-from, .home-visit-time-to { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 120px; }
.home-visit-time-label { font-size: 0.85rem; color: #64748b; font-weight: 500; }
.home-visit-time-sep { color: #94a3b8; font-weight: 500; flex-shrink: 0; padding-bottom: 8px; }
.home-visit-time-inputs input { width: 100%; height: 46px; padding: 10px 14px; }
.home-visit-footer { margin-top: 24px; text-align: right; }
.home-visit-form .portal-form-group input { width: 100%; height: 46px; padding: 12px 16px; box-sizing: border-box; }
.home-visit-form .portal-form-group textarea { width: 100%; resize: vertical; padding: 12px 16px; line-height: 1.5; box-sizing: border-box; }
.home-visit-address textarea { height: 90px; min-height: 90px; max-height: 180px; }
.home-visit-notes { padding-top: 20px; margin-top: 4px; border-top: 1px solid #e2e8f0; }
.home-visit-notes textarea { height: 72px; min-height: 72px; max-height: 140px; }
.home-visit-form .portal-btn { width: 100%; margin-top: 24px; padding: 14px 24px; min-height: 48px; }

@media (max-width: 600px) {
    .portal-container { padding: 24px 20px; }
    .portal-order-card { flex-direction: column; align-items: stretch; }
    .portal-order-action { text-align: center; }
}
