/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* 页面加载动画 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 卡片样式 */
.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 30px;
    margin-bottom: 20px;
}

/* 标题样式 */
h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-weight: 300;
    font-size: 2.5rem;
}

h2 {
    color: #34495e;
    margin-bottom: 20px;
    font-weight: 400;
}

/* 密钥显示区域 */
.key-display {
    text-align: center;
    margin-bottom: 30px;
}

.key-value {
    font-size: 3rem;
    font-weight: bold;
    color: #e74c3c;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 2px dashed #e74c3c;
    display: inline-block;
    min-width: 200px;
    letter-spacing: 5px;
}

/* 网址列表区域 */
.url-list-section {
    margin-bottom: 30px;
    text-align: center;
}

.url-list {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #dee2e6;
}

.url-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.url-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.url-info {
    flex: 1;
    text-align: left;
}

.url-display-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.url-address {
    font-family: 'Courier New', monospace;
    color: #6c757d;
    font-size: 0.9rem;
    word-break: break-all;
}

.url-type-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    margin-left: 10px;
}

.url-type-localhost {
    background: #e3f2fd;
    color: #1976d2;
}

.url-type-local {
    background: #e8f5e8;
    color: #2e7d32;
}

.url-type-public {
    background: #fff3e0;
    color: #f57c00;
}

.url-actions {
    display: flex;
    gap: 8px;
    margin-left: 15px;
}

.url-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.url-action-btn:hover {
    transform: translateY(-1px);
}

.btn-copy {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.btn-copy:hover {
    background: #e9ecef;
    color: #495057;
}

.btn-open {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-open:hover {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* 二维码按钮 */
.btn-qr {
    background: #f1f3f5;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-qr:hover {
    background: #e9ecef;
    color: #343a40;
}

/* 控制面板 */
.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

.form-select,
.btn {
    border-radius: 8px;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-select {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
}

.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* 按钮样式 */
.btn {
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

/* 二维码浮窗样式 */
.qr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.qr-overlay.hidden {
    display: none;
}

.qr-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 380px;
    max-width: 90vw;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.qr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f5;
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.qr-close {
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #6c757d;
}

.qr-close:hover {
    color: #343a40;
}

.qr-body {
    padding: 16px;
    text-align: center;
}

.qr-body img {
    width: 280px;
    height: 280px;
    object-fit: contain;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.qr-text {
    margin-top: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #6c757d;
    word-break: break-all;
}

.qr-actions {
    margin-top: 12px;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(45deg, #56ab2f, #a8e6cf);
    color: white;
}

.btn-danger {
    background: linear-gradient(45deg, #ff416c, #ff4b2b);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* 选区工具样式 */
.selection-area {
    position: relative;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    min-height: 400px;
    margin: 20px 0;
    overflow: hidden;
}

.selection-overlay {
    position: absolute;
    border: 2px solid #007bff;
    background: rgba(0, 123, 255, 0.1);
    cursor: move;
    display: none;
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
}

.resize-handle.nw {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.resize-handle.ne {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.resize-handle.sw {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

.resize-handle.se {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

/* 视频显示区域 */
.video-container {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 9/16;
    margin: 0 auto;
}

.video-display {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* 状态信息 */
.status-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    margin-top: 15px;
    font-family: 'Courier New', monospace;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.status-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.status-value {
    font-size: 1.2rem;
    font-weight: bold;
}

.status-connected {
    color: #28a745;
}

.status-disconnected {
    color: #dc3545;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .card {
        padding: 20px;
    }

    h1 {
        font-size: 2rem;
    }

    .key-value {
        font-size: 2rem;
        letter-spacing: 3px;
    }

    .control-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .form-select,
    .btn {
        width: 100%;
    }

    .status-info {
        flex-direction: column;
        gap: 10px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 画质指示器 */
.quality-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 5px;
    animation: pulse 2s infinite;
}

.quality-hd {
    background-color: #28a745;
}

.quality-normal {
    background-color: #ffc107;
}

.quality-smooth {
    background-color: #dc3545;
}

/* 动画效果 */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

/* 卡片悬停效果 */
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 按钮悬停效果增强 */
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 状态指示器 */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    animation: blink 1.5s infinite;
}

.status-connected {
    background-color: #28a745;
}

.status-connecting {
    background-color: #ffc107;
}

.status-disconnected {
    background-color: #dc3545;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0.3;
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }

    20% {
        opacity: 1;
        transform: translateY(0);
    }

    80% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* 进度条样式 */
.progress-bar-custom {
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

/* 数据统计卡片 */
.stats-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 15px;
    margin: 10px 0;
    color: white;
    transition: all 0.3s ease;
}

.stats-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
}

.stats-number {
    font-size: 2em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stats-label {
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 5px;
}

/* ------------------------------
   Capture 页面专用：紧凑蓝色主题
   ------------------------------ */
body.page-capture {
    background: linear-gradient(180deg, #f6fbff 0%, #eef4ff 100%);
    color: #0f2543;
}

body.page-capture .container {
    max-width: 1100px;
    padding: 16px;
}

body.page-capture .card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e6effb;
    box-shadow: 0 6px 18px rgba(13, 110, 253, 0.06);
    padding: 20px;
    margin-bottom: 16px;
}

body.page-capture h1 {
    color: #0d6efd;
    font-weight: 600;
    font-size: 2rem;
    margin-bottom: 16px;
}

body.page-capture h2 {
    color: #264b87;
    font-size: 1.1rem;
    margin-bottom: 12px;
    font-weight: 600;
}

body.page-capture .panel-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 992px) {
    body.page-capture .panel-row {
        grid-template-columns: 0.5fr 1.5fr;
    }
}

body.page-capture .key-display {
    text-align: left;
    margin-bottom: 0;
}

body.page-capture .key-value {
    font-size: 2rem;
    font-weight: 700;
    color: #0d6efd;
    background: #f0f6ff;
    padding: 6px 16px;
    border-radius: 10px;
    border: 1px solid #cfe2ff;
    letter-spacing: 3px;
    display: inline-block;
}

body.page-capture .url-list-section {
    margin-bottom: 0;
    text-align: left;
}

body.page-capture .url-list {
    background: #f8fbff;
    border: 1px solid #e6effb;
    border-radius: 10px;
    padding: 12px;
}

body.page-capture .url-item {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e7eef9;
}

body.page-capture .url-item:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 10px rgba(13, 110, 253, 0.08);
}

/* 下拉地址列表（紧凑） */
body.page-capture .url-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.page-capture .url-dropdown .form-select {
    flex: 1;
    min-width: 0;
}

body.page-capture .url-dropdown-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.page-capture .url-dropdown-actions .btn {
    padding: 6px 10px;
}

body.page-capture .url-display-name {
    color: #163a6a;
}

body.page-capture .url-address {
    color: #5f6b7a;
}

body.page-capture .url-action-btn {
    background: #f2f7ff;
    color: #2b4d86;
    border: 1px solid #d8e6ff;
}

body.page-capture .url-action-btn:hover {
    background: #e8f2ff;
    color: #0d6efd;
    border-color: #bcd4ff;
}

body.page-capture .control-panel {
    gap: 8px;
    margin: 12px 0;
    justify-content: flex-start;
    flex-wrap: nowrap;
}

body.page-capture .form-select {
    background: #f7fbff;
    border: 1px solid #cfe2ff;
    padding: 6px 10px;
    min-width: 140px;
}

body.page-capture .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

body.page-capture .btn {
    border-radius: 8px;
    padding: 6px 12px;
    white-space: nowrap;
}

body.page-capture .btn-primary {
    background: #0d6efd;
    color: #fff;
}

body.page-capture .btn-primary:hover {
    background: #0b5ed7;
}

body.page-capture .btn-outline-primary {
    color: #0d6efd;
    border: 1px solid #bcd4ff;
    background: #fff;
}

body.page-capture .btn-outline-primary:hover {
    background: #eaf2ff;
    border-color: #8bb6ff;
}

body.page-capture .selection-area {
    border: 1px dashed #cfe2ff;
    background: #f9fcff;
    margin: 16px 0;
}

body.page-capture .selection-overlay {
    border-color: #0d6efd;
    background: rgba(13, 110, 253, 0.12);
}

body.page-capture .resize-handle {
    background: #0d6efd;
}

body.page-capture .stats-card {
    background: #f2f7ff;
    border: 1px solid #e6effb;
    color: #1f3b63;
}

body.page-capture .stats-card-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
}

body.page-capture .stats-label {
    font-size: 0.9rem;
    color: #4c6a99;
}

body.page-capture .stats-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0d6efd;
}

body.page-capture .stats-number {
    color: #0d6efd;
    text-shadow: none;
}

body.page-capture .status-info {
    background: #eef4ff;
    color: #1f3b63;
}

body.page-capture .page-loader {
    background: linear-gradient(180deg, #f2f7ff 0%, #eaf1ff 100%);
}