/* Patient Portal Main Styles - Full Width Version */

/* Patient dashboard landing: group services behind three clear entry points. */
.patient-dashboard .patient-actions-heading {
    align-items: flex-end;
    margin-top: 32px;
    margin-bottom: 16px;
}

.patient-dashboard .patient-actions-heading h3 {
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    line-height: 1.5;
}

.patient-dashboard .patient-services {
    min-width: 0;
}

.patient-dashboard .patient-service-landing {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.patient-dashboard .patient-service-category {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto 18px;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 5px 14px;
    min-height: 122px;
    padding: 20px 18px;
    border: 1px solid #d9e8f7;
    border-radius: 19px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(40, 91, 139, .07);
    color: #214c77;
    cursor: pointer;
    font: inherit;
    text-align: right;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.patient-dashboard .patient-service-category:hover,
.patient-dashboard .patient-service-category:focus-visible {
    border-color: #9fc5ec;
    box-shadow: 0 14px 28px rgba(40, 91, 139, .13);
    outline: none;
    transform: translateY(-2px);
}

.patient-dashboard .patient-service-category:focus-visible,
.patient-dashboard .patient-service-back:focus-visible,
.patient-dashboard .patient-quick-link:focus-visible {
    outline: 3px solid rgba(77, 152, 232, .28);
    outline-offset: 3px;
}

.patient-dashboard .patient-service-category-icon {
    display: grid;
    grid-column: 1;
    grid-row: 1 / 3;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 16px;
    background: #edf6ff;
    color: #4386ca;
}

.patient-dashboard .patient-service-category-icon-support {
    background: #eef8f6;
    color: #348d7b;
}

.patient-dashboard .patient-service-category-icon-companionship {
    background: #fff5e8;
    color: #d58a2b;
}

.patient-dashboard .patient-service-category-icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.65;
}

.patient-dashboard .patient-service-category-copy {
    display: flex;
    grid-column: 2;
    grid-row: 1 / 3;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.patient-dashboard .patient-service-category-copy strong {
    color: #214c77;
    font-size: .94rem;
    font-weight: 850;
    line-height: 1.6;
}

.patient-dashboard .patient-service-category-copy small {
    color: #6b829a;
    font-size: .72rem;
    font-weight: 500;
    line-height: 1.8;
}

.patient-dashboard .patient-service-category-count {
    grid-column: 3;
    grid-row: 1 / 3;
    padding: 5px 8px;
    border-radius: 999px;
    background: #f2f7fc;
    color: #63809e;
    font-size: .65rem;
    font-weight: 750;
    white-space: nowrap;
}

.patient-dashboard .patient-service-category-arrow {
    grid-column: 4;
    grid-row: 1 / 3;
    color: #7ea4ca;
    font-size: 1.15rem;
    transition: transform .2s ease;
}

.patient-dashboard .patient-service-category:hover .patient-service-category-arrow {
    transform: translateX(-3px);
}

.patient-dashboard .patient-service-panel[hidden],
.patient-dashboard .patient-service-landing[hidden] {
    display: none !important;
}

.patient-dashboard .patient-service-panel {
    padding: clamp(18px, 2.4vw, 26px);
    border: 1px solid #d9e8f7;
    border-radius: 21px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 10px 28px rgba(40, 91, 139, .07);
    scroll-margin-top: 24px;
}

.patient-dashboard .patient-service-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.patient-dashboard .patient-service-panel-heading h4 {
    margin: 0 0 4px;
    color: #214c77;
    font-size: 1.05rem;
    font-weight: 850;
    line-height: 1.7;
    scroll-margin-top: 24px;
}

.patient-dashboard .patient-service-panel-heading h4:focus {
    outline: none;
}

.patient-dashboard .patient-service-panel-heading p {
    margin: 0;
    color: #71869d;
    font-size: .74rem;
    line-height: 1.8;
}

.patient-dashboard .patient-service-back {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #d9e8f7;
    border-radius: 11px;
    background: #f7fbff;
    color: #4779aa;
    cursor: pointer;
    font: inherit;
    font-size: .72rem;
    font-weight: 750;
    transition: background .2s ease, border-color .2s ease;
}

.patient-dashboard .patient-service-back:hover {
    border-color: #a9c9ea;
    background: #edf6ff;
}

.patient-dashboard .patient-service-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.patient-dashboard .patient-service-grid .patient-quick-link {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 16px;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 3px 12px;
    width: 100%;
    min-height: 92px;
    padding: 15px;
    border: 1px solid #e0eaf4;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(40, 91, 139, .045);
    text-align: right;
    transform: none;
}

.patient-dashboard .patient-service-grid .patient-quick-link::before {
    display: none;
}

.patient-dashboard .patient-service-grid .patient-quick-link:hover,
.patient-dashboard .patient-service-grid .patient-quick-link:focus-visible {
    border-color: #aacbec;
    background: #fafdff;
    box-shadow: 0 9px 20px rgba(40, 91, 139, .10);
    transform: translateY(-1px);
}

.patient-dashboard .patient-service-grid .patient-quick-link-icon {
    display: grid;
    grid-column: 1;
    grid-row: 1 / 3;
    width: 42px;
    height: 42px;
    place-items: center;
    margin: 0;
    border-radius: 13px;
    background: #eef6ff;
    font-size: 20px;
}

.patient-dashboard .patient-service-grid .patient-quick-link-label {
    grid-column: 2;
    grid-row: 1;
    color: #315c89;
    font-size: .76rem;
    font-weight: 800;
    line-height: 1.65;
}

.patient-dashboard .patient-service-grid .patient-quick-link-description {
    grid-column: 2;
    grid-row: 2;
    color: #71869d;
    font-size: .65rem;
    line-height: 1.7;
}

.patient-dashboard .patient-service-grid .patient-quick-link-arrow {
    grid-column: 3;
    grid-row: 1 / 3;
    color: #91acc7;
    font-size: .95rem;
    transition: transform .2s ease;
}

.patient-dashboard .patient-service-grid .patient-quick-link:hover .patient-quick-link-arrow {
    transform: translateX(-2px);
}

.patient-dashboard #section-faq {
    scroll-margin-top: 20px;
}

@media (max-width: 1024px) {
    .patient-dashboard .patient-service-landing {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .patient-dashboard .patient-service-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .patient-dashboard .patient-actions-heading {
        margin-top: 25px;
    }

    .patient-dashboard .patient-service-landing,
    .patient-dashboard .patient-service-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .patient-dashboard .patient-service-category {
        grid-template-columns: 42px minmax(0, 1fr) auto 14px;
        min-height: 96px;
        gap: 4px 11px;
        padding: 14px;
        border-radius: 16px;
    }

    .patient-dashboard .patient-service-category-icon {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .patient-dashboard .patient-service-category-copy strong {
        font-size: .84rem;
    }

    .patient-dashboard .patient-service-category-copy small {
        font-size: .67rem;
    }

    .patient-dashboard .patient-service-panel {
        padding: 15px;
        border-radius: 17px;
    }

    .patient-dashboard .patient-service-panel-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .patient-dashboard .patient-service-back {
        min-height: 38px;
    }

    .patient-dashboard .patient-service-grid .patient-quick-link {
        min-height: 78px;
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .patient-dashboard .patient-service-category,
    .patient-dashboard .patient-service-back,
    .patient-dashboard .patient-service-grid .patient-quick-link,
    .patient-dashboard .patient-service-category-arrow,
    .patient-dashboard .patient-service-grid .patient-quick-link-arrow {
        transition: none;
    }
}

.patient-portal-wrapper {
    direction: rtl;
    font-family: Vazirmatn, sans-serif;
}

/* Full Width Override */
.patient-dashboard,
.patient-portal-login {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    box-sizing: border-box;
}

/* Remove ast-container limitation */
body .ast-container:has(.patient-dashboard),
body .ast-container:has(.patient-portal-login) {
    max-width: 100% !important;
    padding: 0 !important;
}

/* Avoid viewport-width arithmetic on phones; the parent is already full width. */
@media (max-width: 820px) {
    .patient-dashboard,
    .patient-portal-login {
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

/* Fullscreen mode - Desktop and Mobile */
.patient-portal-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: #f5f7fa;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    min-height: 100vh;
}

/* Hide WordPress admin bar on portal */
.patient-portal-fullscreen ~ #wpadminbar,
body:has(.patient-portal-fullscreen) #wpadminbar {
    display: none;
}

/* Main Dashboard Container */
.patient-dashboard {
    min-height: 100vh;
    background: #f5f7fa;
    font-family: Vazirmatn, sans-serif;
    direction: rtl;
    padding: 0;
    margin: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Header - Full width with blue background */
.patient-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.patient-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.patient-avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    border: 2px solid rgba(255,255,255,0.5);
    flex-shrink: 0;
}

.patient-header-info h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.patient-header-info p {
    margin: 3px 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.patient-logout-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.patient-logout-btn:hover {
    background: rgba(255,255,255,0.3);
    color: white;
}

/* Main Content - Full Width */
.patient-main {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 30px 50px;
    box-sizing: border-box;
    flex: 1;
}

/* Status Card */
.patient-status-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    margin-bottom: 25px;
}

.patient-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.patient-status-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a252f;
    display: flex;
    align-items: center;
    gap: 10px;
}

.patient-status-badge {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #fff3cd;
    color: #856404;
}

.patient-status-badge.active {
    background: #d4edda;
    color: #155724;
}

.patient-progress {
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin: 15px 0;
}

.patient-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 5px;
    transition: width 0.5s;
}

.patient-status-details {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.patient-status-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px 20px;
}

.patient-status-item-label {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 8px;
}

.patient-status-item-value {
    font-size: 14px;
    font-weight: 600;
    color: #1a252f;
}

/* Quick Links */
.patient-quick-links {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.patient-quick-link {
    background: white;
    border-radius: 16px;
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border: none;
    font-family: inherit;
    text-decoration: none;
    color: inherit;
}

.patient-quick-link:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

.patient-quick-link-icon {
    font-size: 35px;
    margin-bottom: 12px;
    display: block;
}

.patient-quick-link-label {
    font-size: 14px;
    font-weight: 600;
    color: #1a252f;
    display: block;
}

/* Chat Section */
.patient-chat-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    overflow: hidden;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
}

.patient-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.patient-chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 25px;
    background: #f8f9fa;
    flex: 1;
}

.patient-chat-message {
    margin-bottom: 15px;
    padding: 14px 18px;
    border-radius: 14px;
    max-width: 70%;
    word-wrap: break-word;
    line-height: 1.7;
    font-size: 14px;
    width: fit-content;
}

.patient-chat-message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.patient-chat-message.bot {
    background: white;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.patient-chat-input-area {
    display: flex;
    gap: 12px;
    padding: 18px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.patient-chat-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e9ecef;
    border-radius: 30px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
    min-width: 0;
}

.patient-chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.patient-chat-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.patient-chat-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.patient-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Tabs */
.patient-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.patient-tab {
    padding: 14px 25px;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #7f8c8d;
    transition: all 0.3s;
    border: none;
    font-family: inherit;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.patient-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.patient-tab:hover {
    transform: translateY(-2px);
}

/* Forms */
.patient-form-section {
    display: none;
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.patient-form-section.active {
    display: block;
}

.patient-form-container {
    width: 100%;
    max-width: 800px;
}

.patient-form-container h3 {
    margin-top: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a252f;
}

.patient-form-group {
    margin-bottom: 20px;
}

.patient-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1a252f;
    margin-bottom: 8px;
}

.patient-form-group input,
.patient-form-group textarea,
.patient-form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
    background: #fafbfc;
    outline: none;
    box-sizing: border-box;
}

.patient-form-group input:focus,
.patient-form-group textarea:focus,
.patient-form-group select:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.08);
}

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

/* Login Page - Full Screen Blue */
.patient-portal-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: Vazirmatn, sans-serif;
    direction: rtl;
    padding: 30px;
    width: 100%;
    box-sizing: border-box;
}

.patient-login-card {
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    padding: 40px 35px;
    max-width: 480px;
    width: 100%;
    animation: patientSlideUp 0.5s ease;
}

@keyframes patientSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Animations */
@keyframes patientFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.patient-animate-in {
    animation: patientFadeIn 0.3s ease;
}

/* Alerts */
.patient-alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 15px;
    display: none;
}

.patient-alert.show {
    display: block;
    animation: patientFadeIn 0.3s ease;
}

.patient-alert-success {
    background: #d4edda;
    color: #155724;
    border-right: 4px solid #27ae60;
}

.patient-alert-error {
    background: #fdecea;
    color: #e74c3c;
    border-right: 4px solid #e74c3c;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .patient-header {
        padding: 20px 30px;
    }
    
    .patient-main {
        padding: 25px 30px;
    }
    
    .patient-status-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .patient-quick-links {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

/* Responsive - Tablet Small */
@media (max-width: 768px) {
    .patient-header {
        padding: 15px 20px;
        flex-direction: column;
        text-align: center;
    }
    
    .patient-header-right {
        flex-direction: column;
        text-align: center;
    }
    
    .patient-main {
        padding: 15px 20px;
    }
    
    .patient-quick-links {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .patient-chat-message {
        max-width: 90%;
    }
    
    .patient-chat-messages {
        height: 300px;
    }
    
    .patient-status-details {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .patient-form-section {
        padding: 20px;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    .patient-header {
        padding: 12px 15px;
    }
    
    .patient-header-info h2 {
        font-size: 16px;
    }
    
    .patient-avatar {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .patient-main {
        padding: 10px 12px;
    }
    
    .patient-quick-links {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .patient-quick-link {
        padding: 15px 10px;
    }
    
    .patient-quick-link-icon {
        font-size: 24px;
    }
    
    .patient-quick-link-label {
        font-size: 11px;
    }
    
    .patient-chat-messages {
        height: 250px;
        padding: 12px;
    }
    
    .patient-chat-message {
        max-width: 95%;
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .patient-chat-input-area {
        padding: 10px;
        gap: 8px;
    }
    
    .patient-chat-input {
        font-size: 12px;
        padding: 10px 14px;
    }
    
    .patient-chat-send {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .patient-status-details {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .patient-status-card {
        padding: 15px;
    }
    
    .patient-form-section {
        padding: 15px;
    }
    
    .patient-tabs {
        gap: 5px;
    }
    
    .patient-tab {
        padding: 8px 12px;
        font-size: 11px;
    }
    
    .patient-form-group input,
    .patient-form-group textarea,
    .patient-form-group select {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* Very Small Phones */
@media (max-width: 360px) {
    .patient-quick-links {
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }
    
    .patient-quick-link {
        padding: 10px 5px;
    }
    
    .patient-quick-link-icon {
        font-size: 20px;
    }
    
    .patient-quick-link-label {
        font-size: 10px;
    }
}

html {
    margin-top: 0 !important;
}

