﻿/* wwwroot/css/dashboard.css */

/* Dashboard Container - Single vertical scroll */
.dashboard {
    min-height: 100vh;
    background: var(--bg-light);
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
}

/* Dashboard Header */
.dashboard-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 15px 20px;
    margin-bottom: 0;
}

.dashboard-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .dashboard-title i {
        color: var(--primary);
        font-size: 1.3rem;
    }

/* Quick Stats - Single Row, No Horizontal Scroll */
.quick-stats {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
    overflow-x: hidden;
}

.stat-card {
    background: var(--white);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
    border: 1px solid var(--border);
    flex: 1; /* همه کارت‌ها عرض یکسان */
    min-width: 0; /* برای text-overflow */
    max-width: 220px; /* حداکثر عرض هر کارت */
}

    .stat-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
        border-color: var(--primary);
    }

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

    .stat-icon.primary {
        background: linear-gradient(135deg, var(--primary-lighter), var(--primary));
        color: var(--white);
    }

    .stat-icon.success {
        background: linear-gradient(135deg, #C6F6D5, #38A169);
        color: var(--white);
    }

    .stat-icon.warning {
        background: linear-gradient(135deg, #FEFCBF, #D69E2E);
        color: var(--white);
    }

    .stat-icon.info {
        background: linear-gradient(135deg, #C3DEFA, #3182CE);
        color: var(--white);
    }

    .stat-icon.secondary {
        background: linear-gradient(135deg, var(--secondary-lighter), var(--secondary));
        color: var(--white);
    }

    .stat-icon.danger {
        background: linear-gradient(135deg, #FED7D7, #E53E3E);
        color: var(--white);
    }

.stat-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Content Grid */
.content-grid {
    padding: 15px 20px 20px 20px; /* padding-bottom: 20px برای فاصله پایین */
    display: flex;
    flex-direction: column;
    gap: 20px; /* فاصله بین ردیف‌ها */
}

.grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.content-card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    height: 340px;
}

    .content-card:hover {
        box-shadow: var(--shadow-md);
    }

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    flex-shrink: 0;
}

    .card-header h3 {
        margin: 0;
        font-size: 1rem;
        font-weight: 600;
        color: var(--text);
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .card-header h3 i {
            color: var(--primary);
            font-size: 1rem;
        }

.card-action-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

    .card-action-link:hover {
        color: var(--primary-light);
        text-decoration: underline;
    }

.schedule-count,
.waiting-count {
    font-size: 0.8rem;
    color: var(--primary);
    background: var(--primary-lighter);
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.update-time {
    font-size: 0.8rem;
    color: var(--text-light);
}

.card-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

    /* Scrollbar for card body */
    .card-body::-webkit-scrollbar {
        width: 6px;
    }

    .card-body::-webkit-scrollbar-track {
        background: var(--bg-light);
        border-radius: 3px;
    }

    .card-body::-webkit-scrollbar-thumb {
        background: var(--primary);
        border-radius: 3px;
    }

/* Empty Space Row - Transparent */
.empty-space-row {
    height: 20px; /* ارتفاع دقیق 20px */
    background: transparent; /* پس‌زمینه شفاف */
}

/* Recent List */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: var(--transition-fast);
}

    .recent-item:hover {
        background: var(--primary-lighter);
        border-color: var(--primary-lighter);
    }

.recent-info {
    flex: 1;
    min-width: 0;
    margin-left: 10px;
}

.recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.patient-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prescription-time {
    font-size: 0.75rem;
    color: var(--text-light);
    background: var(--bg-light);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.recent-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.diagnosis {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.medication-count {
    font-size: 0.75rem;
    color: var(--primary);
    background: var(--primary-lighter);
    padding: 2px 8px;
    border-radius: 8px;
    flex-shrink: 0;
}

.recent-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Schedule List - NO SCROLL */
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.schedule-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: var(--transition-fast);
}

    .schedule-item:hover {
        background: var(--primary-lighter);
        border-color: var(--primary-lighter);
    }

    .schedule-item.waiting {
        border-right: 2px solid var(--warning);
    }

    .schedule-item.completed {
        border-right: 2px solid var(--success);
    }

    .schedule-item.cancelled {
        border-right: 2px solid var(--danger);
    }

.schedule-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    flex-shrink: 0;
}

    .schedule-time .time {
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--text);
    }

    .schedule-time .duration {
        font-size: 0.7rem;
        color: var(--text-light);
        margin-top: 2px;
    }

.schedule-info {
    flex: 1;
    min-width: 0;
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

    .schedule-header .patient-name {
        font-weight: 600;
        color: var(--text);
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
    }

.schedule-type {
    font-size: 0.75rem;
    color: var(--white);
    background: var(--primary);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.schedule-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.purpose {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.status-badge {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 500;
    flex-shrink: 0;
}

    .status-badge.waiting {
        background: #FEFCBF;
        color: #744210;
    }

    .status-badge.completed {
        background: #C6F6D5;
        color: #22543D;
    }

    .status-badge.cancelled {
        background: #FED7D7;
        color: #742A2A;
    }

.schedule-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Medicine List - NO SCROLL */
.medicine-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.medicine-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: var(--transition-fast);
}

    .medicine-item:hover {
        background: var(--primary-lighter);
    }

.medicine-rank {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.medicine-info {
    flex: 1;
    min-width: 0;
}

.medicine-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.85rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.medicine-usage {
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-count {
    font-size: 0.75rem;
    color: var(--text-light);
    min-width: 50px;
}

.usage-bar {
    flex: 1;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.medicine-type {
    flex-shrink: 0;
    color: darkcyan;
}

.type-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
}

/* Waiting List - NO SCROLL */
.waiting-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.waiting-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: var(--transition-fast);
}

    .waiting-item:hover {
        background: var(--primary-lighter);
        border-color: var(--primary-lighter);
    }

.waiting-avatar {
    width: 35px;
    height: 35px;
    background: var(--primary-lighter);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1rem;
    flex-shrink: 0;
}

.waiting-info {
    flex: 1;
    min-width: 0;
}

.waiting-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.waiting-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.waiting-time {
    font-size: 0.75rem;
    color: var(--danger);
    background: #FED7D7;
    padding: 2px 8px;
    border-radius: 8px;
}

.waiting-reason {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.waiting-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Action Buttons */
.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: var(--bg-light);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.85rem;
}

    .action-btn:hover {
        background: var(--primary);
        color: var(--white);
    }

    .action-btn.call:hover {
        background: var(--warning);
        color: var(--white);
    }

    .action-btn.start:hover {
        background: var(--success);
        color: var(--white);
    }

/* Main dashboard scrollbar - تنها اسکرول عمودی */
.dashboard::-webkit-scrollbar {
    width: 8px;
}

.dashboard::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.dashboard::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

    .dashboard::-webkit-scrollbar-thumb:hover {
        background: var(--primary-dark);
    }

/* Responsive Design */
@media (max-width: 1200px) {
    .grid-row {
        gap: 12px;
    }

    .content-card {
        height: 320px;
    }

    .stat-card {
        max-width: 200px;
    }
}

@media (max-width: 992px) {
    .grid-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .content-card {
        height: 300px;
    }

    .quick-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        flex-wrap: wrap;
    }

    .stat-card {
        max-width: none;
        flex: none;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 12px 15px;
    }

    .dashboard-title {
        font-size: 1.2rem;
    }

    .quick-stats {
        padding: 12px 15px;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .content-grid {
        padding: 12px 15px 20px 15px;
        gap: 15px;
    }

    .grid-row {
        gap: 12px;
    }

    .content-card {
        height: 280px;
    }

    .stat-card {
        padding: 10px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .card-header {
        padding: 10px 12px;
    }

    .card-body {
        padding: 12px;
    }
}

@media (max-width: 576px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }

    .content-card {
        height: 260px;
    }

    .content-grid {
        padding-bottom: 20px;
    }

    .recent-item,
    .schedule-item,
    .medicine-item,
    .waiting-item {
        flex-wrap: wrap;
    }

    .recent-actions,
    .schedule-actions,
    .waiting-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
    }

    .empty-space-row {
        height: 15px;
    }
}
