/**
 * Purple Koala — In-App Browser 提示 UI 樣式
 * iab-styles.css
 */

/* =============================================
   頂部提示條 (Banner)
   ============================================= */
#iab-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-bottom: 2px solid #d97706;
    padding: 0;
    animation: iab-slide-down 0.4s ease-out;
}

.iab-banner-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
}

.iab-banner-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.iab-banner-content {
    flex: 1;
    min-width: 0;
}

.iab-banner-title {
    font-weight: 900;
    font-size: 14px;
    color: #92400e;
    margin-bottom: 2px;
}

.iab-banner-desc {
    font-size: 12px;
    color: #78350f;
    line-height: 1.5;
}

.iab-banner-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #92400e;
    padding: 4px 8px;
    line-height: 1;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.iab-banner-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

@keyframes iab-slide-down {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* =============================================
   Modal Overlay
   ============================================= */
.iab-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(20, 10, 35, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: iab-fade-in 0.3s ease-out;
}

@keyframes iab-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* =============================================
   Modal Card
   ============================================= */
.iab-modal-card {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(44, 35, 64, 0.4);
    animation: iab-slide-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(143, 93, 232, 0.2);
}

@keyframes iab-slide-up {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* Header */
.iab-modal-header {
    background: linear-gradient(135deg, #2c2340, #180f28);
    padding: 24px 24px 20px;
    text-align: center;
    border-radius: 20px 20px 0 0;
}

.iab-modal-header-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.iab-modal-title {
    color: #ffe7a0;
    font-size: 18px;
    font-weight: 900;
    margin: 0;
    line-height: 1.4;
}

/* Body */
.iab-modal-body {
    padding: 24px;
}

.iab-modal-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.7;
    margin: 0 0 20px;
}

.iab-modal-desc strong {
    color: #6c3fd1;
    font-weight: 700;
}

/* =============================================
   平台導引區塊
   ============================================= */
.iab-guide-section {
    background: #f9f5ff;
    border: 1px solid #e9d5ff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
}

.iab-guide-title {
    font-size: 14px;
    font-weight: 900;
    color: #6c3fd1;
    margin-bottom: 10px;
}

.iab-guide-steps {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #555;
    line-height: 1.8;
}

.iab-guide-steps li {
    margin-bottom: 4px;
}

.iab-guide-steps li::marker {
    color: #c79a2b;
    font-weight: 700;
}

/* =============================================
   按鈕組
   ============================================= */
.iab-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.iab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s;
    min-height: 52px;
    padding: 14px 20px;
    width: 100%;
    text-align: center;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.iab-btn svg {
    flex-shrink: 0;
}

/* Primary: 以瀏覽器開啟 */
.iab-btn-primary {
    background: linear-gradient(135deg, #6c3fd1, #8f5de8);
    color: #fff;
    box-shadow: 0 6px 20px rgba(108, 63, 209, 0.35);
}

.iab-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 63, 209, 0.45);
}

.iab-btn-primary:active {
    transform: translateY(0);
}

/* Secondary: 複製連結 */
.iab-btn-secondary {
    background: #f5f0ff;
    color: #6c3fd1;
    border: 2px solid #e0d0f7;
}

.iab-btn-secondary:hover {
    background: #ede5fb;
    border-color: #c4b0f0;
}

.iab-btn-copied {
    background: #ecfdf5 !important;
    color: #059669 !important;
    border-color: #a7f3d0 !important;
}

/* Dismiss: 我知道了 */
.iab-btn-dismiss {
    background: transparent;
    color: #94a3b8;
    font-size: 13px;
    min-height: 44px;
    padding: 10px;
    font-weight: 600;
}

.iab-btn-dismiss:hover {
    color: #64748b;
    background: #f8fafc;
}

/* =============================================
   Manual copy fallback
   ============================================= */
.iab-url-display {
    margin-top: 10px;
}

.iab-url-label {
    font-size: 12px;
    color: #94a3b8;
    margin: 0 0 6px;
    font-weight: 600;
}

.iab-url-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 12px;
    color: #334155;
    background: #f8fafc;
    box-sizing: border-box;
    font-family: monospace;
}

.iab-url-input:focus {
    outline: none;
    border-color: #8f5de8;
}

/* =============================================
   In-App Browser 中的 Google 登入按鈕替換
   ============================================= */
.iab-google-login-replacement {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.iab-login-note {
    font-size: 12px;
    color: #92400e;
    background: #fef3c7;
    padding: 10px 14px;
    border-radius: 10px;
    text-align: center;
    line-height: 1.5;
    border: 1px solid #fde68a;
}

.iab-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 300px;
    min-height: 48px;
    padding: 12px 20px;
    border: 2px solid #6c3fd1;
    border-radius: 14px;
    background: linear-gradient(135deg, #f5f0ff, #ede5fb);
    color: #6c3fd1;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.iab-login-btn:hover {
    background: linear-gradient(135deg, #6c3fd1, #8f5de8);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(108, 63, 209, 0.3);
}

/* =============================================
   有 banner 時 nav 偏移
   ============================================= */
body.iab-has-banner .glass-nav {
    top: 0; /* banner 是 fixed 的，nav 也是 fixed，不需要額外偏移  */
}

/* =============================================
   響應式
   ============================================= */
@media (max-width: 480px) {
    .iab-modal-card {
        max-width: 100%;
        border-radius: 16px;
    }

    .iab-modal-header {
        padding: 20px 20px 16px;
        border-radius: 16px 16px 0 0;
    }

    .iab-modal-title {
        font-size: 16px;
    }

    .iab-modal-body {
        padding: 20px;
    }

    .iab-modal-desc {
        font-size: 13px;
    }

    .iab-btn {
        font-size: 14px;
        min-height: 48px;
        padding: 12px 16px;
    }
}

@media (max-width: 360px) {
    .iab-modal-card {
        margin: 8px;
    }

    .iab-modal-header {
        padding: 16px 16px 14px;
    }

    .iab-modal-body {
        padding: 16px;
    }

    .iab-guide-section {
        padding: 12px;
    }
}
