/* Dashboard Styles */
.custom-dashboard-wrapper {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    background: #f8faff;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
}

.cd-header {
    margin-bottom: 40px;
}

.cd-user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.cd-user-info img {
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.cd-welcome h3 {
    margin: 0;
    font-size: 24px;
    color: #1a202c;
    font-weight: 700;
}

.cd-welcome p {
    margin: 5px 0 0;
    color: #718096;
}

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

.cd-stat-card {
    background: #fff;
    padding: 25px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cd-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.cd-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.cd-stat-card.enrolled .cd-stat-icon { background: #e0f2fe; color: #0369a1; }
.cd-stat-card.completed .cd-stat-icon { background: #dcfce7; color: #15803d; }
.cd-stat-card.certificates .cd-stat-icon { background: #fef3c7; color: #b45309; }
.cd-stat-card.students .cd-stat-icon { background: #ede9fe; color: #6d28d9; }
.cd-stat-card.courses .cd-stat-icon { background: #fee2e2; color: #b91c1c; }
.cd-stat-card.activity .cd-stat-icon { background: #f3f4f6; color: #374151; }

.cd-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #1a202c;
}

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

.cd-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cd-section-header h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.cd-link-all {
    text-decoration: none;
    color: #0056b3;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cd-courses-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.cd-course-card {
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

.cd-course-card:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.cd-course-thumb {
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.cd-course-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #1a202c;
}

.cd-course-body {
    padding: 20px;
}

.cd-course-body h5 {
    margin: 0 0 15px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    color: #1a202c;
    height: 48px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cd-progress-container {
    margin-bottom: 20px;
}

.cd-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #718096;
    margin-bottom: 8px;
}

.cd-progress-bar {
    height: 8px;
    background: #edf2f7;
    border-radius: 4px;
    overflow: hidden;
}

.cd-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0056b3, #3b82f6);
    border-radius: 4px;
}

.cd-course-btn {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: center;
    background: #0056b3 !important;
    color: #fff !important;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: background 0.3s ease;
    border: none !important;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
}

.cd-course-btn:hover {
    background: #004494 !important;
}

.cd-teacher-actions {
    display: flex;
    gap: 10px;
}

.cd-course-btn.view { background: #f1f5f9 !important; color: #475569 !important; }
.cd-course-btn.view:hover { background: #e2e8f0 !important; }

.cd-course-btn.edit { background: #0056b3 !important; color: #fff !important; }

.cd-course-meta {
    margin-bottom: 15px;
    font-size: 14px;
    color: #718096;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cd-empty-state {
    text-align: center;
    padding: 40px;
    background: #fff;
    border-radius: 20px;
    grid-column: 1 / -1;
}

.cd-empty-state i {
    font-size: 48px;
    color: #cbd5e0;
    margin-bottom: 15px;
    display: block;
}

.cd-btn-primary {
    display: inline-block;
    padding: 10px 25px;
    background: #0056b3 !important;
    color: #fff !important;
    text-decoration: none;
    border-radius: 10px;
    margin-top: 15px;
    font-weight: 600;
    border: none !important;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .custom-dashboard-wrapper {
        padding: 20px;
    }
    .cd-user-info {
        flex-direction: column;
        text-align: center;
    }
}

/* Modals */
.cd-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cd-modal.active {
    opacity: 1;
    visibility: visible;
}

.cd-modal-content {
    background: #ffffff !important;
    color: #1e293b !important;
    padding: 40px;
    border-radius: 24px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: right;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transform: scale(0.95) translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cd-modal.active .cd-modal-content {
    transform: scale(1) translateY(0);
}

.cd-close-modal {
    position: absolute;
    top: 20px; left: 20px;
    width: 32px; height: 32px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.3s;
}

.cd-close-modal:hover { 
    background: #fee2e2;
    color: #ef4444; 
    transform: rotate(90deg);
}

.cd-modal-content h3 {
    margin: 0 0 25px 0;
    color: #0f172a !important;
    font-size: 22px;
    font-weight: 700;
}

.cd-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e2e8f0 !important;
    border-radius: 14px;
    margin-bottom: 15px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    transition: all 0.3s;
    background: #f8fafc !important;
    color: #0f172a !important;
}

.cd-input:focus {
    border-color: #3b82f6;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.cd-submit-btn {
    width: 100%;
    padding: 15px;
    background: #0056b3 !important;
    background-image: linear-gradient(135deg, #0056b3, #3b82f6) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 14px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.cd-submit-btn:hover { 
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    background-image: linear-gradient(135deg, #004494, #2563eb) !important;
}

.cd-submit-btn:active {
    transform: translateY(0);
}

/* Search Suggestions UI */
.cd-search-container {
    position: relative;
    margin-bottom: 15px;
}
.cd-search-container .cd-input { margin-bottom: 0; }

.cd-search-results {
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px;
    margin-top: 5px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
}

.cd-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff !important;
}
.cd-search-item:last-child { border-bottom: none; }
.cd-search-item:hover { background: #f8fafc !important; }

.cd-search-item img {
    width: 32px; height: 32px;
    border-radius: 50%;
}
.cd-search-item div {
    display: flex;
    flex-direction: column;
}
.cd-search-item strong { font-size: 14px; color: #1e293b !important; }
.cd-search-item span { font-size: 12px; color: #64748b !important; }

/* Chat UI */
.cd-chat-container {
    background: #fff;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    font-family: 'Inter', sans-serif;
}

.cd-chat-header {
    background: #0056b3;
    color: #fff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cd-chat-header h3 { margin: 0; color: #fff; font-size: 18px; }
.cd-chat-header .cd-close-modal { color: #fff; position: static; }
.cd-chat-header .cd-close-modal:hover { color: #cbd5e0; }

.cd-chat-messages {
    flex: 1;
    padding: 20px;
    background: #f8faff;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cd-chat-loading {
    text-align: center;
    color: #a0aec0;
    margin: auto;
}

.chat-msg {
    display: flex;
    gap: 10px;
    max-width: 80%;
}

.chat-msg img {
    width: 35px; height: 35px;
    border-radius: 50%;
}

.chat-msg .msg-bubble {
    background: #fff;
    padding: 12px 15px;
    border-radius: 15px;
    border-top-right-radius: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.chat-msg.me {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg.me .msg-bubble {
    background: #0056b3;
    color: #fff;
    border-radius: 15px;
    border-top-left-radius: 0;
}

.chat-msg .msg-bubble strong {
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
    color: #718096;
}

.chat-msg.me .msg-bubble strong { color: #bee3f8; }

.chat-msg .msg-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.cd-chat-input-area {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.cd-chat-input-area input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-family: 'Inter', sans-serif;
}
.cd-chat-input-area input:focus { outline: none; border-color: #0056b3; }

.cd-chat-input-area button {
    background: #0056b3;
    color: #fff;
    border: none;
    width: 45px; height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}
.cd-chat-input-area button:hover { background: #004494; }

/* Loader CSS */
.cd-loader {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 2px solid #ffffff;
    width: 16px;
    height: 16px;
    display: inline-block;
    animation: cd-spin 1s linear infinite;
    vertical-align: middle;
}

@keyframes cd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
