﻿/**
 * MasterStudy Frontend Admin Hub - Premium Design Overhaul
 * Professional & Highest Level UI/UX
 */

:root {
    --msfah-primary: #1e88e5;
    /* Blue 600 */
    --msfah-primary-hover: #1d4ed8;
    /* Blue 700 */
    --msfah-bg-light: #f8fafc;
    /* Slate 50 */
    --msfah-bg-dark: #0f172a;
    /* Slate 900 */
    --msfah-card-light: #ffffff;
    --msfah-card-dark: #1e293b;
    /* Slate 800 */
    --msfah-text-dark: #0f172a;
    /* Slate 900 */
    --msfah-text-light: #f8fafc;
    /* Slate 50 */
    --msfah-text-muted: #64748b;
    /* Slate 500 */
    --msfah-border-light: #e2e8f0;
    /* Slate 200 */
    --msfah-border-dark: #334155;
    /* Slate 700 */
    --msfah-sidebar-width: 256px;
    --msfah-header-height: 64px;
    --msfah-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --msfah-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.msfah-dark {
    --msfah-bg: var(--msfah-bg-dark);
    --msfah-card: var(--msfah-card-dark);
    --msfah-text: var(--msfah-text-light);
    --msfah-text-secondary: #94a3b8;
    --msfah-border: var(--msfah-border-dark);
}

/* Base Layout */
.msfah-app-v2 {
    background-color: var(--msfah-bg-light);
    font-family: 'Inter', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    color: var(--msfah-text-dark);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.msfah-sidebar-v2,
.msfah-sidebar {
    width: var(--msfah-sidebar-width);
    background: var(--msfah-card-light);
    border-right: 1px solid var(--msfah-border-light);
    z-index: 50;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    transition: transform 0.3s ease;
}

.msfah-sidebar-header-v2,
.msfah-sidebar__header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.msfah-logo-v2 {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--msfah-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msfah-sidebar-header-v2 h1 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--msfah-text-dark);
    margin: 0;
}

.msfah-sidebar-header-v2 p {
    font-size: 12px;
    color: var(--msfah-text-muted);
    margin: 0;
}

/* Navigation Items */
.msfah-nav-v2 {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.msfah-nav-item-v2,
.msfah-sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--msfah-text-muted);
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.msfah-nav-item-v2:hover {
    background: var(--msfah-bg-light);
    color: var(--msfah-text-dark);
}

.msfah-nav-item-v2--active {
    background: var(--msfah-primary);
    color: white !important;
    box-shadow: 0 4px 6px -1px rgba(30, 136, 229, 0.2);
}

.msfah-nav-item-v2--active:hover {
    background: var(--msfah-primary-hover);
    color: white !important;
}

.msfah-nav-item-v2 .material-symbols-outlined {
    font-size: 20px;
}

.msfah-nav-item-v2--active .material-symbols-outlined {
    color: white !important;
}

.msfah-sidebar-footer-v2 {
    padding: 16px;
    border-top: 1px solid var(--msfah-border-light);
    background: var(--msfah-bg-light);
}

/* Main Content Wrapper */
.msfah-main-v2,
.msfah-main {
    flex: 1;
    margin-left: var(--msfah-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.msfah-header-v2,
.msfah-header {
    height: var(--msfah-header-height);
    background: var(--msfah-card-light);
    border-bottom: 1px solid var(--msfah-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.msfah-header-left-v2,
.msfah-header__left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.msfah-header-left-v2 h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.msfah-header-search-v2 {
    position: relative;
    width: 100%;
}

.msfah-header-search-v2 .material-symbols-outlined {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--msfah-text-muted);
}

.msfah-header-search-v2 input {
    width: 100%;
    padding: 8px 16px 8px 40px;
    background: var(--msfah-bg-light);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: ring 0.2s;
}

.msfah-header-search-v2 input:focus {
    box-shadow: 0 0 0 2px var(--msfah-primary);
}

.msfah-header-right-v2,
.msfah-header__right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.msfah-icon-btn-v2 {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--msfah-text-muted);
    transition: background 0.2s;
    cursor: pointer;
    border: none;
    background: transparent;
}

.msfah-icon-btn-v2:hover {
    background: var(--msfah-bg-light);
}

.msfah-user-info-v2 {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 16px;
    border-left: 1px solid var(--msfah-border-light);
}

.msfah-user-text-v2 {
    text-align: right;
}

.msfah-user-name-header {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.msfah-user-role-header {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--msfah-text-muted);
    margin: 0;
    letter-spacing: 0.05em;
}

.msfah-user-avatar-header {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #6366f1;
    /* Indigo 500 */
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

/* Content Area */
.msfah-content-v2,
.msfah-content {
    padding: 32px;
    flex: 1;
    width: 100%;
    max-width: 100%;
}

/* Buttons */
.msfah-btn-v2,
.msfah-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.msfah-btn-v2--primary {
    background: var(--msfah-primary);
    color: white !important;
    box-shadow: 0 4px 6px -1px rgba(30, 136, 229, 0.2);
}

.msfah-btn-v2--primary:hover {
    background: var(--msfah-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(30, 136, 229, 0.3);
}

.msfah-btn-v2--secondary {
    background: white;
    border: 1px solid var(--msfah-border-light);
    color: var(--msfah-text-muted);
}

.msfah-btn-v2--secondary:hover {
    background: var(--msfah-bg-light);
    color: var(--msfah-text-dark);
}

/* Table */
.msfah-table-container-v2,
.msfah-table-wrapper {
    background: var(--msfah-card-light);
    border: 1px solid var(--msfah-border-light);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
}

.msfah-table-v2,
.msfah-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: none !important;
}

.msfah-table-v2 th,
.msfah-table th {
    background: #f8fafc;
    padding: 16px 24px;
    text-align: left;
    font-size: 13px;
    font-weight: var(--msfah-font-weight-bold, 700) !important;
    text-transform: uppercase;
    color: #334155 !important; /* Slate 700 */
    border-bottom: 1px solid var(--msfah-border-light) !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    white-space: nowrap;
}

.msfah-table-v2 td,
.msfah-table td {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    vertical-align: middle;
    background: #ffffff;
    transition: background 0.2s;
    color: #0f172a !important; /* Slate 900 - Almost Black */
    font-weight: var(--msfah-font-weight-base, 600) !important; /* Semi-Bold */
    font-size: 14px !important;
    letter-spacing: -0.01em;
}

.msfah-table-v2 tr:last-child td,
.msfah-table tr:last-child td {
    border-bottom: none !important;
}

.msfah-table-v2 tr:hover td,
.msfah-table tr:hover td {
    background: #f8fafc;
}

/* Badges */
.msfah-badge-v2 {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.msfah-badge-v2--online {
    background: #e0f2fe;
    color: #0284c7;
}

.msfah-badge-v2--published {
    background: #dcfce7;
    color: #166534;
}

/* Search Bar in Content */
.msfah-content-search-bar {
    display: flex;
    gap: 12px;
    background: var(--msfah-card-light);
    padding: 16px;
    border: 1px solid var(--msfah-border-light);
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--msfah-shadow-sm);
    align-items: center;
}

.msfah-content-search-input {
    flex: 1;
    border: 1px solid var(--msfah-border-light);
    padding: 12px 16px;
    outline: none;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.msfah-content-search-input:focus {
    background: #ffffff;
    border-color: var(--msfah-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Course List Specific Styles */
.msfah-course-cell {
    display: flex;
    align-items: center;
    gap: 16px;
}

.msfah-course-thumb-v2 {
    width: 60px;
    height: 40px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-color: #f1f5f9;
    border: 1px solid var(--msfah-border-light);
}

.msfah-course-title-v2 {
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 4px 0;
    color: var(--msfah-text-dark);
    line-height: 1.2;
}

.msfah-course-meta-v2 {
    font-size: 11px;
    color: var(--msfah-text-muted);
    margin: 0;
}

.msfah-actions-v2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.msfah-user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.msfah-avatar-v2 {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #64748b;
    font-size: 14px;
}

.msfah-user-name-v2 {
    font-weight: 500;
    font-size: 14px;
    margin: 0;
    color: var(--msfah-text-dark);
}

.msfah-user-login-v2 {
    font-size: 12px;
    color: var(--msfah-text-muted);
    margin: 0;
}






/* Explicit Font Weights for Inner Elements */
.msfah-user-name,
.msfah-course-title,
.msfah-modal h3,
.msfah-modal h4,
.msfah-student-detail__header h4 {
    font-weight: var(--msfah-font-weight-bold, 700) !important;
    color: var(--msfah-text-dark);
}

.msfah-user-login,
.msfah-course-meta,
.msfah-info-item span,
.msfah-course-item__info a {
    font-weight: var(--msfah-font-weight-base, 500) !important;
}

/* Ensure table cells use the variable */
.msfah-table-v2 td,
.msfah-table td {
    font-weight: var(--msfah-font-weight-base, 500) !important;
}


/* My Page Specific Styles */
.msfah-orders-view h3 {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    padding-bottom: 15px;
    border-bottom: 2px solid #111;
    margin-bottom: 0;
}

.msfah-orders-view .msfah-table-v2 {
    margin-top: 0 !important;
}

.msfah-orders-view .msfah-table-v2 th {
    background: #fff;
    border-bottom: 1px solid #e5e7eb !important;
    color: #111 !important;
    font-weight: 700 !important;
    padding: 15px 10px;
    text-align: center;
}

.msfah-orders-view .msfah-table-v2 td {
    background: #fff;
    border-bottom: 1px solid #f3f4f6 !important;
    padding: 20px 10px;
    text-align: center;
    color: #333 !important;
}

.msfah-orders-view .msfah-table-v2 td:nth-child(2) {
    /* Date column */
    color: #666 !important;
}

.msfah-orders-view .msfah-table-v2 td:nth-child(4) {
    /* Total column */
    font-weight: 700 !important;
}

.msfah-orders-view .msfah-btn-v2--secondary {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
}

.msfah-orders-view .msfah-btn-v2--secondary:hover {
    border-color: #d1d5db;
    background: #f9fafb;
    color: #111;
}

/* Pagination for My Page */
.msfah-orders-view .msfah-pagination {
    margin-top: 30px !important;
}

.msfah-orders-view .msfah-pagination button {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 4px;
}

.msfah-orders-view .msfah-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.msfah-orders-view .msfah-pagination span {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #666;
}


/* Address Manager Styles */
.msfah-addresses-view {
    padding: 10px 0;
}

.msfah-addresses-view h3 {
    font-size: 24px;
    font-weight: 700;
    color: #111;
    margin-bottom: 5px;
}

.msfah-form-group {
    margin-bottom: 20px;
}

.msfah-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
}

.msfah-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2937;
    transition: all 0.2s;
    background: #fff;
    box-sizing: border-box; /* Ensure padding doesn't affect width */
}

.msfah-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
    outline: none;
}

.msfah-input::placeholder {
    color: #9ca3af;
}

/* Ensure grid layout works well on smaller screens */
@media (max-width: 768px) {
    .msfah-addresses-view > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
}


/* Enrolled Courses Redesign */
.msfah-courses-view {
    padding: 10px 0;
}

.msfah-courses-view h3 {
    font-size: 24px;
    font-weight: 700;
    color: #111;
    margin-bottom: 5px;
}

/* Tabs */
.msfah-tabs {
    display: flex;
    gap: 5px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
}

.msfah-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.msfah-tab.active {
    background: #fff;
    color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 600;
}

/* Course Grid */
.msfah-course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.msfah-course-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.msfah-course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.msfah-course-image {
    position: relative;
    height: 180px;
    background: #f3f4f6;
    overflow: hidden;
}

.msfah-course-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msfah-course-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
}

.msfah-badge-blue { background: #3b82f6; }
.msfah-badge-green { background: #10b981; }
.msfah-badge-orange { background: #f59e0b; }
.msfah-badge-gray { background: #6b7280; }

.msfah-course-content {
    padding: 20px;
}

.msfah-course-title {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    margin-bottom: 15px;
    line-height: 1.4;
    height: 44px; /* Limit to 2 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.msfah-course-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.msfah-progress-percent {
    font-weight: 700;
    color: #3b82f6;
}

.msfah-progress-bar {
    height: 6px;
    background: #f3f4f6;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
}

.msfah-progress-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 3px;
}

.msfah-last-lesson {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 20px;
}

.msfah-last-lesson .icon {
    width: 16px;
    height: 16px;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
}

.msfah-btn-full {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
}

/* Pagination Buttons */
.msfah-page-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 4px;
    color: #6b7280;
    cursor: pointer;
    font-size: 13px;
}

.msfah-page-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.msfah-page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
