/* ==========================================
   FLIPBOOK COVER & POPUP LOGIN - RAPI & PROFESIONAL
   ========================================== */

/* GLOBAL RESET FOR EBOOK WRAPPER */
.ebook-wrapper,
.ebook-wrapper *,
.ebook-wrapper *::before,
.ebook-wrapper *::after {
    box-sizing: border-box;
}

.ebook-wrapper {
    max-width: 300px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* ==========================================
   CARD COVER
   ========================================== */
.ebook-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.ebook-card:hover {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

/* COVER */
.ebook-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: #f3f4f6;
    overflow: hidden;
    cursor: pointer;
}

.ebook-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ebook-cover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ebook-cover:hover .ebook-cover-overlay {
    opacity: 1;
}

.ebook-cover-overlay .icon {
    font-size: 40px;
}

.ebook-cover-overlay .text {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.ebook-lock-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* INFO */
.ebook-info {
    padding: 16px 18px 18px;
}

.ebook-info .title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}

.ebook-info .description {
    margin: 0 0 10px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.ebook-info .meta {
    display: flex;
    gap: 14px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #6b7280;
}

.ebook-read-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #dd9933, #f4b659);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ebook-read-btn:hover {
    background: linear-gradient(135deg, #dd9933, #f4b659);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ==========================================
   POPUP LOGIN - RAPI & PROPORSIONAL
   ========================================== */
.fl-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.fl-popup-overlay.is-open {
    display: flex;
}

.fl-popup-backdrop {
    position: absolute;
    inset: 0;
}

.fl-popup-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 40px 36px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
    margin: 20px;
    animation: flPopupIn 0.3s ease;
}

@keyframes flPopupIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* CLOSE BUTTON */
.fl-popup-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    line-height: 1;
}

.fl-popup-close:hover {
    background: #f3f4f6;
    color: #111827;
}

/* HEADER */
.fl-popup-header {
    text-align: center;
    margin-bottom: 28px;
}

.fl-popup-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: #eff6ff;
    border-radius: 50%;
    margin-bottom: 14px;
}

.fl-popup-icon svg {
    width: 28px;
    height: 28px;
    color: #2563eb;
}

.fl-popup-header .title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.fl-popup-header .subtitle {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

/* FORM */
.fl-popup-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.fl-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fl-form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.fl-form-label svg {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

.fl-form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #ffffff;
    font-family: inherit;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.fl-form-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}

.fl-form-input::placeholder {
    color: #9ca3af;
}

/* PASSWORD WRAPPER */
.fl-password-wrapper {
    position: relative;
}

.fl-password-wrapper .fl-form-input {
    padding-right: 44px;
}

.fl-toggle-pass {
    position: absolute;
    right: -80%;
    top: 50%;
    transform: translateY(-100%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

button.fl-toggle-pass {
    background-color: transparent !important;
}

.fl-toggle-pass:hover {
    color: #2563eb;
    background: #f3f4f6;
}

.fl-toggle-pass svg {
    width: 18px;
    height: 18px;
}

.fl-toggle-pass .icon-eye-off {
    display: none;
}

.fl-toggle-pass.showing .icon-eye {
    display: none;
}

.fl-toggle-pass.showing .icon-eye-off {
    display: block;
}

/* MESSAGE */
.fl-form-message {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    display: none;
}

.fl-form-message.is-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    display: block;
}

.fl-form-message.is-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    display: block;
}

/* SUBMIT BUTTON */
.fl-submit-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #D6B004, #b29308);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fl-submit-btn:hover {
    background: linear-gradient(135deg, #D6B004, #b29308);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}

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

.fl-submit-btn:disabled {
    background: #93b5f0 !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.fl-submit-text,
.fl-submit-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fl-submit-text svg {
    width: 18px;
    height: 18px;
}

.fl-submit-loading {
    display: none;
}

.fl-submit-loading svg {
    width: 18px;
    height: 18px;
}

.fl-spinner {
    animation: flSpin 0.8s linear infinite;
}

@keyframes flSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 480px) {
    .ebook-wrapper {
        max-width: 100%;
        margin: 12px 10px;
    }

    .fl-popup-dialog {
        padding: 28px 20px 24px;
        margin: 12px;
        max-width: 100%;
        border-radius: 12px;
    }

    .fl-popup-header .title {
        font-size: 18px;
    }

    .fl-popup-header .subtitle {
        font-size: 13px;
    }

    .fl-popup-icon {
        width: 48px;
        height: 48px;
    }

    .fl-popup-icon svg {
        width: 24px;
        height: 24px;
    }

    .fl-form-input {
        font-size: 13px;
        padding: 8px 12px;
    }

    .fl-submit-btn {
        font-size: 14px;
        padding: 10px 16px;
        min-height: 44px;
    }

    .ebook-info {
        padding: 12px 14px 14px;
    }

    .ebook-info .title {
        font-size: 14px;
    }
}

/* Popup untuk grid */
.fl-popup-overlay {
    display: none !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}

.fl-popup-overlay.is-open {
    display: flex !important;
}

.fl-popup-backdrop {
    position: absolute !important;
    inset: 0 !important;
}