/* ============================================
   MAIN APP STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.app-logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0f172a;
}

.app-nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.app-nav .bookmark {
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 6px 14px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app-nav .bookmark:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.app-nav .bookmark .icon {
    font-size: 1rem;
}

.app-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    min-height: 400px;
}

/* ============================================
   POPUP OVERLAY
   ============================================ */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.popup-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.popup-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    width: 880px;
    max-width: 94vw;
    height: 680px;
    max-height: 88vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.popup-window.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* ============================================
   POPUP HEADER
   ============================================ */
.popup-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 16px 16px 0 0;
    cursor: default;
    user-select: none;
    flex-shrink: 0;
    border-bottom: 1px solid #e9ecef;
    min-height: 42px;
    gap: 10px;
}

.popup-header .close-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: #ff5f57;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.popup-header .close-btn:hover {
    background: #e04444;
}

.popup-header .title-area {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.popup-header .title-area .favicon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: #d0d0d0;
    flex-shrink: 0;
}

.popup-header .title-area .title-text {
    font-size: 0.82rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popup-header .url-bar {
    flex: 2;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 20px;
    padding: 2px 14px;
    font-size: 0.78rem;
    color: #1a1a2e;
    height: 30px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.popup-header .url-bar .lock {
    font-size: 0.7rem;
    opacity: 0.6;
    flex-shrink: 0;
}

.popup-header .url-bar .domain {
    font-weight: 500;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popup-header .url-bar .path {
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popup-header .spacer {
    width: 30px;
    flex-shrink: 0;
}

/* ============================================
   POPUP CONTENT
   ============================================ */
.popup-content {
    flex: 1;
    background: #ffffff;
    border-radius: 0 0 16px 16px;
    overflow: hidden;
    position: relative;
}

.popup-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.popup-content .loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #666;
    font-size: 0.9rem;
}

.popup-content .loading .spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e8e8e8;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .app-nav {
        gap: 8px;
    }

    .app-nav .bookmark {
        font-size: 0.8rem;
        padding: 4px 10px;
    }

    .popup-window {
        width: 96vw;
        max-height: 92vh;
    }

    .popup-header {
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px 10px;
        min-height: auto;
    }

    .popup-header .url-bar {
        order: 3;
        flex: 1 1 100%;
        height: 26px;
        font-size: 0.7rem;
    }

    .popup-header .title-area .title-text {
        font-size: 0.7rem;
    }

    .popup-header .close-btn {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }
}