/* ==============================================
   LMS Library — Premium Dark Theme
   Colors: Dark Blue #081321, Gold #D4AF37, White
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Reset & Wrapper ── */
.lms-library-wrapper {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #e8e6f0;
    background: #081321;
    padding: 40px 32px;
    border-radius: 24px;
    min-height: 400px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow: hidden;
}

.lms-library-wrapper::before {
    content: '';
    position: absolute;
    top: -150px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.lms-library-wrapper::after {
    content: '';
    position: absolute;
    bottom: -200px;
    right: -150px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.lms-library-wrapper * {
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* ── Page Header ── */
.lms-library-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.lms-library-header-icon {
    font-size: 32px;
    line-height: 1;
}

.lms-library-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(180deg, #FFFFFF 30%, rgba(255, 255, 255, 0.65) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

/* ── Full Library Banner ── */
.lms-library-full-banner {
    background: linear-gradient(135deg,
            rgba(212, 175, 55, 0.1) 0%,
            rgba(212, 175, 55, 0.04) 50%,
            rgba(212, 175, 55, 0.08) 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lms-library-full-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(212, 175, 55, 0.1);
}

.lms-library-full-banner-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg,
            transparent 0%,
            rgba(212, 175, 55, 0.06) 25%,
            transparent 50%,
            rgba(212, 175, 55, 0.04) 75%,
            transparent 100%);
    animation: lms-lib-glow-spin 8s linear infinite;
    pointer-events: none;
}

@keyframes lms-lib-glow-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.lms-library-full-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: relative;
    z-index: 2;
}

.lms-library-full-banner-text {
    display: flex;
    align-items: center;
    gap: 20px;
}

.lms-library-full-banner-icon {
    font-size: 36px;
    line-height: 1;
    flex-shrink: 0;
}

.lms-library-full-banner-title {
    font-size: 22px;
    font-weight: 700;
    color: #D4AF37;
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
}

.lms-library-full-banner-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    line-height: 1.5;
}

.lms-library-full-banner-action {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.lms-library-full-banner-price {
    font-size: 24px;
    font-weight: 800;
    color: #D4AF37;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* Owned full library state */
.lms-library-full-banner-owned {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.08) 0%,
            rgba(255, 255, 255, 0.02) 100%);
    border-color: rgba(255, 255, 255, 0.15);
    padding: 48px 24px;
    display: flex;
    justify-content: center;
}

.lms-library-full-banner-owned .lms-library-full-banner-content {
    justify-content: center;
    width: 100%;
}

.lms-library-full-banner-owned .lms-library-full-banner-text {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    width: 100%;
}

.lms-library-full-banner-owned .lms-library-full-banner-icon {
    font-size: 48px;
}

.lms-library-full-banner-owned .lms-library-full-banner-title {
    color: #D4AF37;
    font-size: 24px;
}

/* ── Buttons ── */
.lms-library-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.lms-library-btn svg {
    flex-shrink: 0;
}

.lms-library-btn-primary {
    background: linear-gradient(135deg, #D4AF37 0%, #b8942e 100%);
    color: #081321;
    padding: 14px 28px;
    font-size: 15px;
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.25);
}

.lms-library-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.35);
    color: #081321;
}

.lms-library-btn-read {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.lms-library-btn-read:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    transform: translateY(-1px);
}

.lms-library-btn-download {
    background: rgba(212, 175, 55, 0.12);
    color: #D4AF37;
    border: 1px solid rgba(212, 175, 55, 0.25);
}

.lms-library-btn-download:hover {
    background: rgba(212, 175, 55, 0.2);
    color: #D4AF37;
    transform: translateY(-1px);
}

.lms-library-btn-unlock {
    background: linear-gradient(135deg, #D4AF37 0%, #b8942e 100%);
    color: #081321;
    width: 100%;
    padding: 12px 20px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.lms-library-btn-unlock:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
}

.lms-library-btn-upgrade {
    background: linear-gradient(135deg, #D4AF37 0%, #b8942e 100%);
    color: #081321;
    width: 100%;
    padding: 12px 20px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.lms-library-btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
}

.lms-library-btn:disabled,
.lms-library-btn.lms-library-btn-loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.lms-library-btn-spinner {
    display: inline-flex;
    align-items: center;
}

/* ── Guide Cards ── */
.lms-library-guides {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.lms-library-guide-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(212, 175, 55, 0.1);
    border-radius: 20px;
    padding: 32px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lms-library-guide-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(212, 175, 55, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

/* Guide Header */
.lms-library-guide-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.08);
}

.lms-library-guide-thumb {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(212, 175, 55, 0.08) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lms-library-guide-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lms-library-guide-thumb-placeholder {
    font-size: 28px;
}

.lms-library-guide-info {
    flex: 1;
    min-width: 0;
}

.lms-library-guide-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #D4AF37;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.2);
    padding: 3px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.lms-library-guide-name {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
}

.lms-library-guide-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    line-height: 1.5;
}

/* ── Volumes Grid ── */
.lms-library-volumes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.lms-library-volume-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
}

.lms-library-volume-card:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Unlocked state */
.lms-library-volume-unlocked {
    border-color: rgba(212, 175, 55, 0.3);
    background: rgba(212, 175, 55, 0.05);
}

.lms-library-volume-unlocked:hover {
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.08);
}

/* Locked states */
.lms-library-volume-needs_vol1 {
    opacity: 0.5;
}

/* Volume Header */
.lms-library-volume-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lms-library-volume-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.lms-library-volume-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.lms-library-volume-unlocked .lms-library-volume-icon {
    background: rgba(212, 175, 55, 0.15);
    color: #D4AF37;
}

.lms-library-volume-buy_vol1 .lms-library-volume-icon,
.lms-library-volume-upgrade .lms-library-volume-icon,
.lms-library-volume-locked .lms-library-volume-icon {
    background: rgba(212, 175, 55, 0.1);
    color: rgba(212, 175, 55, 0.6);
}

.lms-library-volume-needs_vol1 .lms-library-volume-icon {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.25);
}

.lms-library-volume-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.lms-library-volume-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.lms-library-volume-status {
    font-size: 12px;
    font-weight: 500;
}

.lms-library-volume-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
    margin: 8px 0 0 0;
}

.lms-library-status-unlocked {
    color: #D4AF37;
}

.lms-library-status-buy_vol1,
.lms-library-status-locked,
.lms-library-status-upgrade {
    color: rgba(212, 175, 55, 0.7);
}

.lms-library-status-needs_vol1 {
    color: rgba(255, 255, 255, 0.25);
}

/* Volume Actions */
.lms-library-volume-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

.lms-library-volume-actions .lms-library-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.lms-library-volume-disabled {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
    padding: 10px 0;
    font-weight: 500;
}

.lms-library-volume-no-pdf {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.35);
    font-style: italic;
}

/* ── Empty State ── */
.lms-library-empty {
    text-align: center;
    padding: 80px 20px;
}

.lms-library-empty p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.4);
}

/* ── Fade-in Animation ── */
.lms-lib-fade-in {
    opacity: 0;
    transform: translateY(24px);
    animation: lms-lib-fade-up 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.lms-lib-fade-in:nth-child(1) {
    animation-delay: 0.05s;
}

.lms-lib-fade-in:nth-child(2) {
    animation-delay: 0.12s;
}

.lms-lib-fade-in:nth-child(3) {
    animation-delay: 0.19s;
}

.lms-lib-fade-in:nth-child(4) {
    animation-delay: 0.26s;
}

.lms-lib-fade-in:nth-child(5) {
    animation-delay: 0.33s;
}

@keyframes lms-lib-fade-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Toast Notification ── */
.lms-library-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #0d1f33;
    color: #ffffff;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(212, 175, 55, 0.2);
    z-index: 99999;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', system-ui, sans-serif;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

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

.lms-library-toast-error {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.15);
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .lms-library-wrapper {
        padding: 28px 20px;
    }

    .lms-library-full-banner-content {
        flex-direction: column;
        text-align: center;
    }

    .lms-library-full-banner-text {
        flex-direction: column;
        text-align: center;
    }

    .lms-library-full-banner-action {
        flex-direction: column;
        width: 100%;
    }

    .lms-library-full-banner-action .lms-library-btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .lms-library-volumes {
        grid-template-columns: 1fr;
    }

    .lms-library-guide-header {
        flex-direction: column;
        text-align: center;
    }

    .lms-library-guide-label {
        align-self: center;
    }

    .lms-library-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .lms-library-wrapper {
        padding: 20px 16px;
        border-radius: 16px;
    }

    .lms-library-guide-card {
        padding: 20px;
    }

    .lms-library-volume-card {
        padding: 16px;
    }

    .lms-library-full-banner {
        padding: 24px;
    }

    .lms-library-full-banner-title {
        font-size: 18px;
    }
}

/* ── WooCommerce Override ── */
/* Hide default WooCommerce orders table if it somehow renders */
.woocommerce-MyAccount-content .woocommerce-orders-table,
.woocommerce-MyAccount-content .woocommerce-message--info,
.woocommerce-MyAccount-content .woocommerce-info {
    display: none;
}

/* Make the My Account content area blend with library and hide navigation */
.woocommerce-account:has(.lms-library-wrapper) .woocommerce-MyAccount-navigation {
    display: none !important;
}

.woocommerce-account:has(.lms-library-wrapper) .woocommerce-MyAccount-content {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent;
}
