/**
 * iPhone 浏览器应用 - iOS Safari 风格
 * 白色主题，完全还原iOS Safari的高级感和原生app体验
 */

.iphone-browser-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.iphone-browser-page.show {
    display: flex;
    animation: slideInFromRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 浏览器头部 - 搜索栏 */
.browser-header {
    position: relative;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: #ffffff;
    z-index: 10;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
}

.browser-back-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #000000;
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    padding: 0;
    z-index: 11;
}

.browser-back-btn:active {
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(0.95);
}

.browser-back-btn i {
    font-size: 18px;
}

.browser-title {
    font-size: 17px;
    font-weight: 600;
    color: #000000;
    margin: 0;
    letter-spacing: -0.4px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.browser-generate-btn {
    background: none;
    border: none;
    color: #007AFF;
    font-size: 17px;
    font-weight: 400;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s ease;
    z-index: 11;
}

.browser-generate-btn:active {
    opacity: 0.4;
}

.browser-generate-btn.generating {
    opacity: 0.6;
    pointer-events: none;
}

/* 搜索栏区域 */
.browser-search-bar {
    background: #f2f2f7;
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    display: none;
}

.browser-search-icon {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

.browser-search-text {
    flex: 1;
    font-size: 17px;
    color: #8e8e93;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

/* 浏览器内容区域 */
.browser-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f2f2f7;
    -webkit-overflow-scrolling: touch;
}

.browser-content::-webkit-scrollbar {
    display: none;
}

/* 空状态 */
.browser-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
}

.browser-empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.browser-empty-text {
    font-size: 22px;
    font-weight: 600;
    color: #000000;
    margin-bottom: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}

.browser-empty-hint {
    font-size: 15px;
    color: #8e8e93;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

/* 加载动画 */
.browser-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
}

.browser-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #007aff;
    border-radius: 50%;
    animation: browser-spin 0.8s linear infinite;
}

@keyframes browser-spin {
    to { transform: rotate(360deg); }
}

.browser-loading-text {
    margin-top: 20px;
    font-size: 15px;
    color: #8e8e93;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

/* 收藏夹网格 */
.browser-favorites-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 24px 16px;
}

.browser-favorite-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.browser-favorite-item:active {
    transform: scale(0.95);
}

.browser-favorite-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e5ea;
}

.browser-favorite-name {
    font-size: 12px;
    color: #000000;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

/* 搜索历史列表 */
.browser-history-section {
    padding: 16px;
}

.browser-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 0 4px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.browser-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.browser-history-item {
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid #e5e5ea;
}

.browser-history-item:active {
    background: #f2f2f7;
}

.browser-history-favicon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #f2f2f7;
    flex-shrink: 0;
}

.browser-history-content {
    flex: 1;
    min-width: 0;
}

.browser-history-title {
    font-size: 16px;
    font-weight: 500;
    color: #000000;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.browser-history-url {
    font-size: 13px;
    color: #8e8e93;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.browser-history-time {
    font-size: 12px;
    color: #8e8e93;
    flex-shrink: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

/* 网页详情页 */
.browser-detail-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 1001;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.browser-detail-page.show {
    display: flex;
    animation: slideInFromRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.browser-detail-header {
    padding: 12px 16px 12px;
    background: #ffffff;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
}

.browser-detail-top {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.browser-detail-back-btn {
    background: none;
    border: none;
    color: #007aff;
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.browser-detail-back-btn:active {
    opacity: 0.6;
}

.browser-detail-url-bar {
    flex: 1;
    background: #f2f2f7;
    border-radius: 10px;
    padding: 8px 14px;
    margin-left: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}

.browser-detail-lock {
    width: 12px;
    height: 12px;
    fill: #8e8e93;
}

.browser-detail-url {
    flex: 1;
    font-size: 14px;
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    min-width: 0;
}

/* 浏览器工具栏 */
.browser-toolbar {
    display: flex;
    justify-content: space-around;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
}

.browser-toolbar-btn {
    background: none;
    border: none;
    color: #8e8e93;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.browser-toolbar-btn:active {
    color: #007aff;
}

/* 网页内容 */
.browser-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    background: #ffffff;
    -webkit-overflow-scrolling: touch;
}

.browser-detail-content::-webkit-scrollbar {
    display: none;
}

.browser-webpage-title {
    font-size: 28px;
    font-weight: 700;
    color: #000000;
    margin-bottom: 16px;
    line-height: 1.3;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}

.browser-webpage-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.browser-webpage-favicon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #f2f2f7;
}

.browser-webpage-domain {
    font-size: 14px;
    color: #8e8e93;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.browser-webpage-date {
    font-size: 13px;
    color: #8e8e93;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.browser-webpage-body {
    font-size: 17px;
    line-height: 1.6;
    color: #000000;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.browser-webpage-body p {
    margin-bottom: 16px;
}

.browser-webpage-body h2 {
    font-size: 22px;
    font-weight: 600;
    color: #000000;
    margin: 24px 0 12px 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}

.browser-webpage-body ul,
.browser-webpage-body ol {
    margin: 16px 0;
    padding-left: 24px;
}

.browser-webpage-body li {
    margin-bottom: 8px;
}

/* 角色内心独白区域 */
.browser-thought-section {
    margin-top: 32px;
    padding: 20px;
    background: linear-gradient(135deg, #ffeef8 0%, #fff5f7 100%);
    border-radius: 16px;
    border: 2px solid rgba(255, 182, 193, 0.3);
    box-shadow: 0 4px 16px rgba(255, 105, 180, 0.08);
    position: relative;
    overflow: hidden;
}

.browser-thought-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 182, 193, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.browser-thought-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.browser-thought-icon {
    font-size: 20px;
    animation: thought-pulse 2s ease-in-out infinite;
}

@keyframes thought-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.browser-thought-title {
    font-size: 15px;
    font-weight: 600;
    color: #ff69b4;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    letter-spacing: -0.3px;
}

.browser-thought-content {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    letter-spacing: -0.2px;
    font-style: italic;
    position: relative;
    z-index: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    border-left: 3px solid #ff69b4;
}

/* 快捷访问建议 */
.browser-suggestions {
    padding: 16px;
}

.browser-suggestion-item {
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid #e5e5ea;
}

.browser-suggestion-item:last-child {
    margin-bottom: 0;
}

.browser-suggestion-item:active {
    background: #f2f2f7;
}

/* 隐私浏览标签 */
.browser-private-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(175, 82, 222, 0.2);
    color: #af52de;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

/* 滑动动画 */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式调整 */
@media (max-width: 375px) {
    .browser-favorites-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    
    .browser-favorite-icon {
        width: 52px;
        height: 52px;
        font-size: 24px;
    }
}

/* 标签页预览 */
.browser-tabs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
}

.browser-tab-item {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #e5e5ea;
}

.browser-tab-item:active {
    background: #f2f2f7;
}

.browser-tab-preview {
    height: 120px;
    background: linear-gradient(135deg, #f2f2f7 0%, #e5e5ea 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.browser-tab-info {
    padding: 10px 12px;
}

.browser-tab-title {
    font-size: 13px;
    font-weight: 500;
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.browser-tab-url {
    font-size: 11px;
    color: #8e8e93;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}