/* ===== ENHANCED DASHBOARD CSS - IMPROVED LAYOUT & CONSISTENCY (FIXED) =====
 * Now uses global variables from variables.css
 * Aligned with MedPrepOnline teal theme
 */

/* ===== DASHBOARD LAYOUT SYSTEM ===== */
.dashboard-container {
    min-height: 100vh;
    background-color: var(--bg-gray);
    padding-top: 0;
}

.dashboard-main {
    padding: 2rem 0;
}

.dashboard-sidebar {
    position: sticky;
    top: calc(2rem + 20px);
    max-height: calc(100vh - 2rem * 2);
    overflow-y: auto;
}

/* ===== ENHANCED CARD SYSTEM ===== */
.dashboard-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: var(--transition-smooth);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--bg-gray) 0%, var(--bg-white) 100%);
    flex-shrink: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-subtitle {
    color: var(--text-medium);
    font-size: 0.875rem;
    margin: 0.25rem 0 0;
    opacity: 0.8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.course-count {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
}

.view-all-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: color var(--transition-fast);
}

.view-all-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.card-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* ===== CONTINUE LEARNING COMPONENT ===== */
.continue-learning-card .card-body {
    min-height: 200px;
}

.continue-course-wrapper {
    flex-grow: 1;
}

.course-thumbnail {
    width: 100%;
    height: 140px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.course-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
}

.course-info h3.course-title {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    line-height: 1.3;
}

.course-instructor {
    color: var(--text-medium);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.course-progress-info {
    margin-bottom: 1rem;
}

.progress-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-medium);
}

.progress-percentage {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
}

.course-progress-bar {
    height: 8px;
    background-color: var(--bg-gray-dark);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.course-progress-bar .progress-bar {
    background: var(--primary-gradient);
    transition: width 0.5s ease;
}

.last-lesson {
    color: var(--text-medium);
    font-size: 0.875rem;
    margin: 0;
    display: flex;
    align-items: center;
}

.course-action-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

/* ===== MY COURSES COMPONENT ===== */
.courses-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex-grow: 1;
}

.course-card-mini {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: var(--transition-smooth);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.course-card-mini:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.course-thumbnail-mini {
    width: 80px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.course-thumbnail-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-placeholder-mini {
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.badge-new {
    position: absolute;
    top: 2px;
    right: 3px;
    background: var(--success-green);
    color: white;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.course-info-mini {
    flex-grow: 1;
    min-width: 0;
}

.course-title-mini {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.course-title-mini a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.course-title-mini a:hover {
    color: var(--primary-color);
}

.course-progress-mini {
    margin-top: 0.5rem;
}

.mini-progress {
    height: 4px;
    background-color: var(--bg-gray-dark);
    border-radius: var(--radius-full);
}

.mini-progress .progress-bar {
    background: var(--primary-gradient);
}

/* ===== WEEKLY GOALS COMPONENT ===== */
.goal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.goal-item {
    padding: 1rem;
    background: var(--bg-gray);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    transition: var(--transition-fast);
}

.goal-item:hover {
    background: var(--bg-gray-dark);
}

.goal-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.goal-content {
    flex-grow: 1;
}

.goal-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.goal-progress-text {
    font-size: 0.875rem;
    color: var(--text-medium);
    margin-bottom: 0.5rem;
}

.goal-progress-bar {
    height: 6px;
    background: var(--bg-gray-dark);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.goal-progress-bar .progress-bar {
    background: var(--primary-gradient);
}

/* ===== PROGRESS OVERVIEW ===== */
.progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.progress-card {
    background: var(--primary-gradient);
    color: white;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: var(--transition-smooth);
}

.progress-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-primary);
}

.progress-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.progress-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.progress-text {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 500;
}

/* ===== NOTIFICATIONS & MESSAGES ===== */
.notification-list,
.message-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item,
.message-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: var(--transition-fast);
}

.notification-item:hover,
.message-item:hover {
    background: var(--bg-gray);
}

.notification-item:last-child,
.message-item:last-child {
    border-bottom: none;
}

.notification-icon,
.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon {
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.notification-content,
.message-content {
    flex-grow: 1;
}

.notification-title,
.message-sender {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.notification-text,
.message-preview {
    font-size: 0.875rem;
    color: var(--text-medium);
    margin-bottom: 0.25rem;
}

.notification-time,
.message-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.notification-badge {
    background: var(--primary-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.unread {
    background: var(--primary-light);
    border-left: 3px solid var(--primary-color);
}

/* ===== UPCOMING TASKS ===== */
.task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-item {
    padding: 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: var(--transition-fast);
}

.task-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-light);
    border-radius: 6px;
    flex-shrink: 0;
    cursor: pointer;
    transition: var(--transition-fast);
}

.task-checkbox:hover {
    border-color: var(--primary-color);
}

.task-checkbox.checked {
    background: var(--primary-gradient);
    border-color: var(--primary-color);
    position: relative;
}

.task-checkbox.checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 1rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.task-content {
    flex-grow: 1;
}

.task-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.task-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-medium);
}

.task-priority {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    backdrop-filter: blur(10px);
}

.priority-high {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-red);
}

.priority-medium {
    background: rgba(255, 193, 7, 0.1);
    color: var(--warning-yellow);
}

.priority-low {
    background: rgba(23, 162, 184, 0.1);
    color: var(--info-blue);
}

/* ===== BUTTONS ===== */
.btn-dashboard {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition-smooth);
}

.btn-dashboard:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
    color: white;
}

.btn-outline-dashboard {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition-smooth);
}

.btn-outline-dashboard:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

/* ===== WELCOME SECTION ===== */
.welcome-section {
    background: var(--primary-gradient);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.welcome-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ===== EMPTY STATES ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-medium);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 1rem;
    color: var(--text-medium);
}

/* ===== RESPONSIVE DESIGN IMPROVEMENTS ===== */
@media (max-width: 1200px) {
    .dashboard-main {
        padding: 1.5rem 0;
    }

    .course-thumbnail {
        height: 120px;
    }
}

@media (max-width: 992px) {
    .dashboard-sidebar {
        position: static;
        max-height: none;
    }

    .course-card-mini {
        flex-direction: column;
        text-align: center;
    }

    .course-thumbnail-mini {
        width: 100px;
        height: 75px;
        margin: 0 auto 1rem;
    }

    .task-meta {
        flex-direction: column;
        gap: 0.25rem;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding-top: 1rem;
    }

    .welcome-section {
        padding: 1.5rem 0;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .card-header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .card-body {
        padding: 1rem;
    }

    .progress-card {
        padding: 2rem 1.5rem;
    }

    .progress-number {
        font-size: 2rem;
    }

    .course-action-group {
        margin-top: 1rem;
    }

    .continue-course-wrapper .row {
        flex-direction: column;
        text-align: center;
    }

    .course-thumbnail {
        height: 100px;
        max-width: 200px;
        margin: 0 auto 1rem;
    }
}

@media (max-width: 576px) {
    .welcome-title {
        font-size: 1.5rem;
    }

    .progress-number {
        font-size: 1.75rem;
    }

    .course-card-mini {
        padding: 1rem;
    }

    .task-item {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .task-checkbox {
        margin: 0 auto 0.5rem;
    }

    .notification-item,
    .message-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== FOCUS STATES ===== */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ===== CUSTOM SCROLLBAR ===== */
.notification-list::-webkit-scrollbar,
.message-list::-webkit-scrollbar,
.dashboard-sidebar::-webkit-scrollbar {
    width: 6px;
}

.notification-list::-webkit-scrollbar-track,
.message-list::-webkit-scrollbar-track,
.dashboard-sidebar::-webkit-scrollbar-track {
    background: var(--bg-gray);
    border-radius: var(--radius-sm);
}

.notification-list::-webkit-scrollbar-thumb,
.message-list::-webkit-scrollbar-thumb,
.dashboard-sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--radius-sm);
}

.notification-list::-webkit-scrollbar-thumb:hover,
.message-list::-webkit-scrollbar-thumb:hover,
.dashboard-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ===== LOADING ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.dashboard-card {
    animation: fadeInUp 0.6s ease-out forwards;
}

.progress-card {
    animation: slideInLeft 0.8s ease-out forwards;
}

.dashboard-sidebar .dashboard-card {
    animation: slideInRight 0.8s ease-out forwards;
}

/* ===== UTILITY CLASSES ===== */
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-hover {
    transition: box-shadow var(--transition-smooth);
}

.shadow-hover:hover {
    box-shadow: var(--shadow-md);
}

.border-gradient {
    border: 2px solid transparent;
    background: linear-gradient(var(--bg-white), var(--bg-white)) padding-box, var(--primary-gradient) border-box;
}

/* ===== PRINT STYLES ===== */
@media print {
    .dashboard-container {
        background: var(--bg-white) !important;
    }

    .dashboard-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid var(--border-light) !important;
    }

    .btn,
    .header-actions {
        display: none !important;
    }

    .welcome-section {
        background: var(--bg-white) !important;
        color: var(--text-dark) !important;
    }
}

/* ===== Daily Progress Card ===== */
.daily-progress-card .card-body {
    padding: 2rem;
}

.daily-progress-circle {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    transition: stroke-dasharray 0.6s ease;
    stroke-linecap: round;
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-ring-text .progress-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.progress-ring-text .progress-label {
    font-size: 0.875rem;
    color: var(--text-medium);
}

.daily-stats {
    margin-top: 1.5rem;
}

.stat-box {
    padding: 1rem;
    background: var(--bg-gray);
    border-radius: var(--radius-md);
}

.stat-box i {
    font-size: 1.5rem;
}

.stat-box h4 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.5rem 0 0.25rem;
}

/* ===== Lesson Completion Badge ===== */
.lesson-completion-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid var(--success-green);
    border-radius: var(--radius-xl);
    color: #15803d;
    font-size: 0.9rem;
}

.lesson-completion-stats {
    padding: 0.75rem 1rem;
    background: rgba(40, 167, 69, 0.1);
    border-radius: var(--radius-md);
    color: var(--success-green);
    font-size: 0.875rem;
    text-align: center;
}

/* ===== Toast Notifications ===== */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}