/**
 * EduMaster Pro - Premium UI Components
 * 统一响应式设计系统
 */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #0f172a;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --white: #ffffff;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-blue: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0,0,0,0.25);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;
}

/* ================================
   1. Base Typography
   ================================ */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--dark);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }

/* ================================
   2. Premium Card Component
   ================================ */
.premium-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
}

.premium-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-2xl);
    border-color: transparent;
}

.premium-card .card-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/10;
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
}

.premium-card .card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.premium-card:hover .card-media img {
    transform: scale(1.08);
}

.premium-card .card-body {
    padding: 24px;
}

.premium-card .card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.premium-card .card-text {
    font-size: 14px;
    color: var(--gray-500);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ================================
   3. Premium Button System
   ================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-blue);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.5);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover {
    background: var(--gray-100);
}

.btn-sm { padding: 10px 20px; font-size: 13px; }
.btn-lg { padding: 18px 36px; font-size: 16px; }

/* ================================
   4. Hero Section
   ================================ */
.hero-section {
    position: relative;
    padding: 80px 20px 100px;
    text-align: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    z-index: 0;
}

.hero-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 40%),
        radial-gradient(circle at 60% 80%, rgba(255,255,255,0.08) 0%, transparent 30%);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    color: var(--white);
    margin: 0 0 20px;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.hero-title .icon {
    font-size: clamp(2rem, 5vw, 3rem);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.hero-title .text {
    background: linear-gradient(120deg, #fff 0%, rgba(255,255,255,0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(255,255,255,0.9);
    margin: 0 0 40px;
    line-height: 1.6;
}

/* ================================
   5. Search Box
   ================================ */
.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-full);
    padding: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.search-input {
    flex: 1;
    border: none;
    padding: 18px 24px;
    font-size: 16px;
    background: transparent;
    outline: none;
    border-radius: var(--radius-full);
}

.search-btn {
    width: 56px;
    height: 56px;
    border: none;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    transform: scale(1.05);
    background: var(--primary-dark);
}

/* ================================
   6. Filter Bar
   ================================ */
.filter-section {
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.filter-bar {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    max-width: 1400px;
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--gray-50);
    border-radius: var(--radius-full);
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.filter-item:hover {
    background: var(--gray-100);
    color: var(--dark);
}

.filter-item.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.filter-item .icon { font-size: 16px; }

/* ================================
   7. Content Grid
   ================================ */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

/* ================================
   8. Featured Badge
   ================================ */
.featured-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    background: linear-gradient(135deg, var(--accent), #d97706);
    color: var(--white);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* ================================
   9. Type Tag
   ================================ */
.type-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    background: rgba(255,255,255,0.95);
    color: var(--dark);
}

.type-tag.course { background: #dbeafe; color: #1d4ed8; }
.type-tag.video { background: #fce7f3; color: #be185d; }
.type-tag.training { background: #fef3c7; color: #b45309; }
.type-tag.tutorial { background: #e0e7ff; color: #4338ca; }

/* ================================
   10. Card Overlay
   ================================ */
.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

/* ================================
   11. Card Meta Info
   ================================ */
.card-meta {
    margin-bottom: 16px;
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.meta-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--danger);
}

.meta-price.free {
    color: var(--success);
    font-size: 14px;
    font-weight: 600;
}

.meta-stat {
    font-size: 14px;
    color: var(--gray-500);
}

/* ================================
   12. Card CTA Button
   ================================ */
.card-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--dark);
    color: var(--white);
    border-radius: var(--radius-lg);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.card-cta:hover {
    background: var(--primary);
}

.card-cta .arrow {
    transition: transform 0.3s;
}

.card-cta:hover .arrow {
    transform: translateX(4px);
}

/* ================================
   13. Pagination
   ================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 60px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-radius: var(--radius-md);
    color: var(--dark);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    padding: 0 16px;
}

.pagination a:hover {
    background: var(--primary);
    color: var(--white);
}

.pagination .current {
    background: var(--primary);
    color: var(--white);
}

/* ================================
   14. Empty State
   ================================ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 80px;
    opacity: 0.4;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    color: var(--dark);
    margin: 0 0 8px;
}

.empty-state p {
    color: var(--gray-500);
    font-size: 16px;
}

/* ================================
   15. Grid Layouts
   ================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* ================================
   16. Badge System
   ================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #d1fae5; color: #059669; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }

/* ================================
   17. Animation Keyframes
   ================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in-up { animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-fade-in { animation: fadeIn 0.5s ease-out forwards; }
.animate-slide-in-left { animation: slideInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-slide-in-right { animation: slideInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-scale-in { animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* Staggered animation delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

/* ================================
   18. Container & Section
   ================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 80px 20px;
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
}

.section-title h2 {
    margin: 0 0 16px;
}

.section-title p {
    font-size: 18px;
    color: var(--gray-500);
    max-width: 600px;
    margin: 0 auto;
}

/* ================================
   19. Custom Scrollbar
   ================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 10px;
    border: 2px solid var(--gray-100);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ================================
   20. Loading Skeleton
   ================================ */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ================================
   21. Toast Notification
   ================================ */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--dark);
    color: var(--white);
    padding: 16px 28px;
    border-radius: var(--radius-full);
    font-weight: 600;
    box-shadow: var(--shadow-2xl);
    z-index: 9999;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ================================
   22. Mobile Navigation
   ================================ */
.mobile-nav-dock {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    height: 70px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--gray-200);
    border-radius: 35px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 20px;
    z-index: 9998;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--gray-400);
    text-decoration: none;
    transition: all 0.3s;
    padding: 8px 16px;
    border-radius: var(--radius-lg);
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item .icon {
    font-size: 24px;
}

.mobile-nav-item .label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-nav-item.center-btn {
    position: relative;
    top: -20px;
}

.mobile-nav-item.center-btn .icon-wrap {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

/* ================================
   23. Fullscreen Mobile Menu
   ================================ */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--white);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
}

.mobile-menu-overlay.active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid var(--gray-100);
}

.mobile-menu-logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
}

.mobile-menu-close {
    width: 48px;
    height: 48px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--gray-600);
    transition: all 0.3s;
}

.mobile-menu-close:hover {
    background: #fee2e2;
    color: var(--danger);
}

.mobile-menu-nav {
    padding: 30px;
}

.mobile-menu-nav a {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    padding: 20px 0;
    border-bottom: 1px solid var(--gray-100);
    text-decoration: none;
    transition: color 0.3s;
}

.mobile-menu-nav a:hover {
    color: var(--primary);
}

.mobile-menu-footer {
    padding: 30px;
    border-top: 1px solid var(--gray-100);
    margin-top: auto;
}

/* ================================
   24. Responsive Breakpoints
   ================================ */
@media (max-width: 1280px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .hero-section { padding: 60px 20px 80px; }
    .hero-title { flex-direction: column; gap: 8px; }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .filter-bar {
        justify-content: flex-start;
        padding: 12px;
    }
    
    .filter-item {
        padding: 10px 18px;
        font-size: 13px;
    }
    
    .section { padding: 60px 16px; }
    .container { padding: 0 16px; }
    
    .pagination {
        margin-top: 40px;
    }
    
    .pagination a,
    .pagination span {
        min-width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .btn { padding: 12px 24px; }
    .btn-sm { padding: 8px 16px; }
    .btn-lg { padding: 16px 32px; }
}

@media (max-width: 480px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .search-box { padding: 6px; }
    .search-input { padding: 14px 16px; }
    .search-btn { width: 48px; height: 48px; }
    
    .mobile-nav-dock { bottom: 10px; left: 10px; right: 10px; height: 64px; }
}

/* ================================
   25. Utility Classes
   ================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mt-5 { margin-top: 40px; }
.mt-6 { margin-top: 48px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mb-5 { margin-bottom: 40px; }
.mb-6 { margin-bottom: 48px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }
.p-5 { padding: 40px; }
.p-6 { padding: 48px; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.hidden { display: none; }
.block { display: block; }
.flex { display: flex; }
.grid { display: grid; }
.inline-flex { display: inline-flex; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.gap-4 { gap: 32px; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }
.z-100 { z-index: 100; }

.transition { transition: all 0.3s; }
.transition-fast { transition: all 0.15s; }
.transition-slow { transition: all 0.5s; }

/* Body padding for mobile nav */
@media (max-width: 1024px) {
    body { padding-bottom: 100px; }
}