/* ============================================================
   FutureX Components
   Reusable primitives — buttons, badges, course cards, inputs.
   Consumes tokens.css — never hard-code values here.
   ============================================================ */

/* =====================================================
   BUTTONS
   ===================================================== */
.fx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--fx-space-2);
    font-family: var(--fx-font-body);
    font-weight: 600;
    font-size: var(--fx-text-sm);
    line-height: 1;
    padding: var(--fx-space-3) var(--fx-space-7);
    border-radius: var(--fx-radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--fx-duration-base) var(--fx-ease);
    white-space: nowrap;
    user-select: none;
}

.fx-btn:hover { transform: translateY(-1px); }
.fx-btn:active { transform: translateY(0); }

/* Primary — warm orange CTA */
.fx-btn-primary {
    background: var(--fx-primary);
    color: var(--fx-text-inverse);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}
.fx-btn-primary:hover {
    background: var(--fx-primary-hover);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.35);
}

/* Secondary — dark, solid */
.fx-btn-secondary {
    background: var(--fx-canvas);
    color: var(--fx-text-inverse);
}
.fx-btn-secondary:hover { background: var(--fx-canvas-3); }

/* Outline — bordered, transparent */
.fx-btn-outline {
    background: transparent;
    color: var(--fx-text);
    border-color: var(--fx-border);
}
.fx-btn-outline:hover {
    border-color: var(--fx-border-strong);
    background: var(--fx-bg-elevated);
}

/* Ghost — text only */
.fx-btn-ghost {
    background: transparent;
    color: var(--fx-primary);
    border: none;
}
.fx-btn-ghost:hover { background: var(--fx-primary-soft); }

/* Accent — crimson pill, used for Buy Now */
.fx-btn-accent {
    background: var(--fx-accent);
    color: var(--fx-text-inverse);
    padding: var(--fx-space-2) var(--fx-space-5);
    border-radius: var(--fx-radius-pill);
    box-shadow: 0 4px 12px rgba(217, 4, 41, 0.25);
}
.fx-btn-accent:hover {
    background: var(--fx-accent-hover);
    box-shadow: 0 8px 24px rgba(217, 4, 41, 0.35);
}

/* Sizes */
.fx-btn-sm { font-size: var(--fx-text-xs); padding: var(--fx-space-2) var(--fx-space-4); }
.fx-btn-lg { font-size: var(--fx-text-base); padding: var(--fx-space-4) var(--fx-space-8); }
.fx-btn-xl { font-size: var(--fx-text-lg); padding: var(--fx-space-5) var(--fx-space-10); }

/* Block */
.fx-btn-block { display: flex; width: 100%; }

/* =====================================================
   BADGES
   ===================================================== */
.fx-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--fx-space-1);
    padding: var(--fx-space-1) var(--fx-space-3);
    border-radius: var(--fx-radius-pill);
    font-size: var(--fx-text-xs);
    font-weight: 700;
    letter-spacing: var(--fx-tracking-wide);
    text-transform: uppercase;
    line-height: 1;
}

.fx-badge-free    { background: var(--fx-success); color: var(--fx-text-inverse); }
.fx-badge-paid    { background: var(--fx-primary); color: var(--fx-text-inverse); }
.fx-badge-sale    { background: var(--fx-accent); color: var(--fx-text-inverse); }
.fx-badge-completed { background: var(--fx-canvas); color: var(--fx-text-inverse); }
.fx-badge-rating {
    background: rgba(255, 255, 255, 0.95);
    color: var(--fx-text);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.fx-badge-rating-dark {
    background: var(--fx-canvas);
    color: var(--fx-text-inverse);
}
.fx-badge-category {
    background: transparent;
    color: var(--fx-primary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: var(--fx-tracking-wider);
    padding: 0;
    font-size: var(--fx-text-xs);
}

/* =====================================================
   COURSE CARD
   ===================================================== */
.fx-course-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--fx-bg);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-lg);
    overflow: hidden;
    box-shadow: var(--fx-shadow-sm);
    transition: all var(--fx-duration-base) var(--fx-ease);
}

.fx-course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--fx-shadow-xl);
    border-color: transparent;
}

.fx-course-thumb-wrap {
    position: relative;
    overflow: hidden;
}

.fx-course-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(135deg, var(--fx-canvas) 0%, var(--fx-canvas-3) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fx-course-thumb img,
.fx-course-thumb .fx-thumb-placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--fx-duration-slow) var(--fx-ease);
}

.fx-course-card:hover .fx-course-thumb img,
.fx-course-card:hover .fx-thumb-placeholder {
    transform: scale(1.05);
}

.fx-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: rgba(255, 255, 255, 0.3);
}

.fx-course-badges {
    position: absolute;
    top: var(--fx-space-3);
    left: var(--fx-space-3);
    display: flex;
    gap: var(--fx-space-1);
    z-index: 2;
}

.fx-course-actions {
    position: absolute;
    top: var(--fx-space-3);
    right: var(--fx-space-3);
    display: flex;
    gap: var(--fx-space-2);
    z-index: 2;
}

.fx-course-rating-badge {
    position: absolute;
    bottom: var(--fx-space-3);
    left: var(--fx-space-3);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px 4px 6px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: var(--fx-radius-pill);
    font-size: 12px;
    font-weight: 700;
    color: var(--fx-text);
    line-height: 1;
    z-index: 2;
}
.fx-course-rating-badge .stars {
    color: var(--fx-highlight);
    font-size: 13px;
}

.fx-icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 18px;
    line-height: 1;
    color: var(--fx-text-muted);
    transition: all var(--fx-duration-fast) var(--fx-ease);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}
.fx-icon-btn > img {
    width: 20px;
    height: 20px;
    display: block;
}
.fx-icon-btn:hover {
    transform: scale(1.1);
    background: #fff;
}

.fx-icon-btn.fx-wishlisted { color: var(--fx-danger); }
.fx-icon-btn.fx-in-cart {
    background: var(--fx-success);
    color: var(--fx-text-inverse);
}
.fx-icon-btn.fx-in-cart > img { filter: brightness(0) invert(1); }

.fx-course-body {
    padding: var(--fx-space-5);
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: var(--fx-space-2);
}

.fx-course-title {
    font-family: var(--fx-font-display);
    font-size: var(--fx-text-base);
    font-weight: 700;
    line-height: var(--fx-leading-snug);
    color: var(--fx-text);
    margin: var(--fx-space-1) 0;
}
.fx-course-title a {
    color: inherit;
    text-decoration: none;
}
.fx-course-title a:hover { color: var(--fx-primary); }

.fx-course-excerpt {
    font-size: var(--fx-text-sm);
    color: var(--fx-text-muted);
    line-height: var(--fx-leading-normal);
    margin: 0;
    flex: 1;
}

.fx-course-rating {
    display: flex;
    align-items: center;
    gap: var(--fx-space-2);
    font-size: var(--fx-text-xs);
    color: var(--fx-text-muted);
    margin: var(--fx-space-1) 0;
}
.fx-course-rating .stars { color: var(--fx-highlight); letter-spacing: 1px; }

.fx-course-info {
    display: flex;
    gap: var(--fx-space-3);
    font-size: var(--fx-text-xs);
    color: var(--fx-text-muted);
    padding: var(--fx-space-3) 0;
    border-top: 1px solid var(--fx-border);
    margin-top: var(--fx-space-2);
    flex-wrap: wrap;
}

.fx-course-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--fx-space-3);
    border-top: 1px solid var(--fx-border);
    margin-top: var(--fx-space-2);
    gap: var(--fx-space-3);
}

.fx-course-price {
    font-family: var(--fx-font-mono);
    font-size: var(--fx-text-lg);
    font-weight: 700;
    color: var(--fx-text);
}
.fx-course-price.is-free { color: var(--fx-success); }
.fx-course-price del {
    color: var(--fx-text-subtle);
    font-size: var(--fx-text-sm);
    font-weight: 500;
    margin-right: var(--fx-space-1);
}
.fx-course-price ins {
    color: var(--fx-accent);
    text-decoration: none;
}

/* =====================================================
   INPUTS
   ===================================================== */
.fx-input {
    width: 100%;
    padding: var(--fx-space-3) var(--fx-space-4);
    font-family: var(--fx-font-body);
    font-size: var(--fx-text-sm);
    color: var(--fx-text);
    background: var(--fx-bg);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-md);
    transition: all var(--fx-duration-fast) var(--fx-ease);
    outline: none;
}
.fx-input:focus {
    border-color: var(--fx-primary);
    box-shadow: 0 0 0 3px var(--fx-primary-soft);
}
.fx-input::placeholder { color: var(--fx-text-subtle); }

.fx-select {
    padding: var(--fx-space-2) var(--fx-space-3) var(--fx-space-2) var(--fx-space-3);
    font-size: var(--fx-text-sm);
    color: var(--fx-text);
    background: var(--fx-bg);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-pill);
    cursor: pointer;
    outline: none;
}

/* =====================================================
   LOADING + SKELETON
   ===================================================== */
.fx-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--fx-border);
    border-top-color: var(--fx-primary);
    border-radius: 50%;
    animation: fx-spin 0.8s linear infinite;
}
@keyframes fx-spin { to { transform: rotate(360deg); } }

.fx-loading {
    pointer-events: none;
    opacity: 0.6;
}

.fx-skeleton {
    background: linear-gradient(90deg, var(--fx-bg-elevated) 25%, var(--fx-bg-subtle) 50%, var(--fx-bg-elevated) 75%);
    background-size: 200% 100%;
    animation: fx-shimmer 1.4s ease-in-out infinite;
    border-radius: var(--fx-radius-md);
}
@keyframes fx-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =====================================================
   SECTION SPACING
   ===================================================== */
.fx-section {
    padding: var(--fx-space-20) 0;
}

.fx-section-tight {
    padding: var(--fx-space-12) 0;
}

.fx-section-cream {
    background: var(--fx-bg-elevated);
}

.fx-section-dark {
    background: var(--fx-canvas);
    color: var(--fx-text-inverse);
}

.fx-container {
    max-width: var(--fx-container-max);
    margin: 0 auto;
    padding: 0 var(--fx-container-padding);
}

.fx-section-header {
    text-align: center;
    margin-bottom: var(--fx-space-12);
}
.fx-section-header h2 {
    font-family: var(--fx-font-display);
    font-size: var(--fx-text-4xl);
    font-weight: 800;
    line-height: var(--fx-leading-tight);
    letter-spacing: var(--fx-tracking-tight);
    margin: 0 0 var(--fx-space-2);
}
.fx-section-header p {
    font-size: var(--fx-text-lg);
    color: var(--fx-text-muted);
    margin: 0;
}
.fx-section-dark .fx-section-header p {
    color: var(--fx-text-inverse-muted);
}

/* =====================================================
   GRIDS
   ===================================================== */
.fx-grid {
    display: grid;
    gap: var(--fx-space-6);
}
.fx-grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.fx-grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.fx-grid-4 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* =====================================================
   GLASSMORPHISM HEADER HELPER
   ===================================================== */
.fx-glass {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* =====================================================
   ANIMATION HELPERS
   ===================================================== */
.fx-fade-in {
    animation: fx-fade-in 0.4s var(--fx-ease) both;
}
@keyframes fx-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fx-pop {
    animation: fx-pop 0.3s var(--fx-ease) both;
}
@keyframes fx-pop {
    0% { transform: scale(0.92); }
    60% { transform: scale(1.03); }
    100% { transform: scale(1); }
}