/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme colors */
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96%;
    --secondary-foreground: 222.2 84% 4.9%;
    --muted: 210 40% 96%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96%;
    --accent-foreground: 222.2 84% 4.9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --input-foreground: 222.2 84% 4.9%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.5rem;

    /* Success/Warning/Error colors */
    --success: 142.1 76.2% 36.3%;
    --success-foreground: 355.7 100% 97.3%;
    --warning: 32.5 94.6% 43.7%;
    --warning-foreground: 355.7 100% 97.3%;
    --error: 0 84.2% 60.2%;
    --error-foreground: 210 40% 98%;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: 222.2 84% 4.9%;
        --foreground: 210 40% 98%;
        --card: 222.2 84% 4.9%;
        --card-foreground: 210 40% 98%;
        --popover: 222.2 84% 4.9%;
        --popover-foreground: 210 40% 98%;
        --primary: 217.2 91.2% 59.8%;
        --primary-foreground: 222.2 84% 4.9%;
        --secondary: 217.2 32.6% 17.5%;
        --secondary-foreground: 210 40% 98%;
        --muted: 217.2 32.6% 17.5%;
        --muted-foreground: 215 20.2% 65.1%;
        --accent: 217.2 32.6% 17.5%;
        --accent-foreground: 210 40% 98%;
        --destructive: 0 62.8% 30.6%;
        --destructive-foreground: 210 40% 98%;
        --border: 217.2 32.6% 17.5%;
        --input: 217.2 32.6% 17.5%;
        --input-foreground: 210 40% 98%;
        --ring: 224.3 76.3% 94.1%;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    font-feature-settings: "rlig" 1, "calt" 1;
    min-height: 100vh;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* Content Container for Boxed Layout */
.content-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* Header Styles */
.header {
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--background));
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    text-align: center;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 0.5rem;
}

.language-switcher {
    display: flex;
    align-items: center;
}

#languageBtn {
    min-width: 4rem;
}

@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    .language-switcher {
        order: -1;
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-radius: var(--radius);
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}

.subtitle {
    font-size: 1rem;
    color: hsl(var(--muted-foreground));
    font-weight: 400;
}

/* Main Content */
.main {
    flex: 1;
    padding: 2rem 0 3rem;
}

/* Card Styles */
.card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 2px);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    color: hsl(var(--card-foreground));
}

.card-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-description {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    line-height: 1.25;
}

.card-content {
    padding: 1.5rem;
}

.download-card {
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    color: hsl(var(--muted-foreground));
    z-index: 10;
    pointer-events: none;
}

.input-with-icon-padding {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
}

/* 代理状态指示器 */
.proxy-status {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.proxy-status.success {
    background-color: hsl(142 76% 36%);
    color: white;
}

.proxy-status.error {
    background-color: hsl(0 84% 60%);
    color: white;
}

.proxy-status.testing {
    background-color: hsl(47 96% 53%);
    color: white;
}

.proxy-status-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 动画效果 */
.proxy-status.testing .proxy-status-icon {
    animation: spin 1s linear infinite;
}

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

.input {
    flex: 1;
    height: 2.5rem;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background: hsl(var(--background));
    color: hsl(var(--input-foreground));
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input::placeholder {
    color: hsl(var(--muted-foreground));
}

.textarea {
    width: 100%;
    min-height: 4rem;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background: hsl(var(--background));
    color: hsl(var(--input-foreground));
    padding: 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s;
}

.textarea:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.textarea::placeholder {
    color: hsl(var(--muted-foreground));
}

.select {
    height: 2.5rem;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background: hsl(var(--background));
    color: hsl(var(--input-foreground));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    cursor: pointer;
}

.select:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.btn-sm {
    height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    height: 2.75rem;
    padding: 0 2rem;
    font-size: 0.875rem;
}

/* 下载按钮间距 */
#downloadBtn {
    margin-top: 1.5rem;
}

.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
    background: hsl(var(--primary) / 0.9);
}

.btn-outline {
    border: 1px solid hsl(var(--input));
    background: hsl(var(--background));
    color: hsl(var(--foreground));
}

.btn-outline:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

/* Checkbox Styles */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox {
    width: 1rem;
    height: 1rem;
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius) - 2px);
    background: hsl(var(--background));
    cursor: pointer;
}

.checkbox:checked {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    color: hsl(var(--foreground));
}

.checkbox-icon {
    color: hsl(var(--muted-foreground));
}

/* Proxy Settings */
.proxy-settings {
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1rem;
    background: hsl(var(--muted) / 0.3);
}

.help-text {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.5rem;
}

/* Advanced Settings */
.advanced-toggle-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.advanced-toggle-link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0;
    background: none;
    border: none;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
}

.advanced-toggle-link:hover {
    color: hsl(var(--foreground));
}

.advanced-toggle-link .chevron-icon {
    transition: transform 0.2s;
}

.advanced-toggle-link.active .chevron-icon {
    transform: rotate(180deg);
}

.advanced-toggle-link.active {
    color: hsl(var(--foreground));
}

.advanced-panel {
    margin-top: 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--card));
    overflow: hidden;
    transition: all 0.3s ease;
}

.advanced-panel.hidden {
    display: none;
}

.advanced-panel-content {
    padding: 1.5rem;
}

.setting-group {
    margin-bottom: 2rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
}

.setting-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.setting-content {
    transition: all 0.3s ease;
}

.setting-content.hidden {
    display: none;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: hsl(var(--input));
    border-radius: 0.75rem;
    transition: all 0.2s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 1.25rem;
    width: 1.25rem;
    left: 0.125rem;
    bottom: 0.125rem;
    background: white;
    border-radius: 50%;
    transition: all 0.2s;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.toggle-input:checked + .toggle-label .toggle-slider {
    background: hsl(var(--primary));
}

.toggle-input:checked + .toggle-label .toggle-slider:before {
    transform: translateX(1.5rem);
}

.toggle-input:focus + .toggle-label .toggle-slider {
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* Custom Headers */
.headers-list {
    margin-bottom: 1rem;
}

.header-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

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

.header-key-input,
.header-value-input {
    flex: 1;
    height: 2.5rem;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background: hsl(var(--background));
    color: hsl(var(--input-foreground));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.header-key-input {
    max-width: 200px;
}

.header-key-input:focus,
.header-value-input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.header-key-input::placeholder,
.header-value-input::placeholder {
    color: hsl(var(--muted-foreground));
}

.remove-header-btn {
    height: 2.5rem;
    width: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.remove-header-btn:hover {
    background: hsl(var(--destructive) / 0.9);
}

.add-header-btn {
    width: 100%;
    justify-content: center;
}

/* User Agent Presets */
.ua-preset-wrapper {
    margin-bottom: 1rem;
}

/* Lucide Icons */
.lucide-icon {
    width: 16px;
    height: 16px;
}

.lucide-icon-xs {
    width: 12px;
    height: 12px;
}

.lucide-icon-sm {
    width: 14px;
    height: 14px;
}

.lucide-icon-lg {
    width: 24px;
    height: 24px;
}

.input-icon.lucide-icon-sm {
    position: absolute;
    left: 0.75rem;
    color: hsl(var(--muted-foreground));
    pointer-events: none;
    z-index: 1;
}

/* Progress Styles */
.progress-card {
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.progress {
    width: 100%;
    height: 0.5rem;
    background: hsl(var(--secondary));
    border-radius: var(--radius);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: hsl(var(--primary));
    border-radius: var(--radius);
    transition: width 0.3s ease;
    width: 0%;
}

.text-muted {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

/* Log Styles */
.log-card {
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.log-content {
    background: hsl(220 13% 18%);
    color: hsl(220 14% 96%);
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.8rem;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.4;
}

.log-entry {
    margin-bottom: 0.25rem;
    padding: 0.125rem 0;
}

.log-entry.success {
    color: hsl(142 76% 56%);
}

.log-entry.error {
    color: hsl(0 84% 70%);
    font-weight: 500;
}

.log-entry.warning {
    color: hsl(38 92% 65%);
}

.log-entry.info {
    color: hsl(220 14% 71%);
}

/* Features Section */
.features {
    background: hsl(var(--muted) / 0.3);
    border-top: 1px solid hsl(var(--border));
    padding: 4rem 0;
}

.features-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
}

.features-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: hsl(var(--foreground));
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.feature-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 4px);
    padding: 2rem;
    text-align: center;
    transition: all 0.2s;
}

.feature-card:hover {
    box-shadow: 0 4px 12px 0 rgb(0 0 0 / 0.1);
    transform: translateY(-2px);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    background: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    border-radius: var(--radius);
    margin: 0 auto 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
}

.feature-card p {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Footer */
.footer {
    border-top: 1px solid hsl(var(--border));
    padding: 2rem 0;
    background: hsl(var(--background));
}

.footer p {
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Responsive Design */

/* Tablet styles */
@media (max-width: 1024px) {
    .content-container,
    .download-card,
    .progress-card,
    .log-card {
        max-width: 100%;
        margin-left: 1rem;
        margin-right: 1rem;
    }

    .features-content {
        max-width: 100%;
        padding: 0 1rem;
    }
}

/* Small tablet styles */
@media (max-width: 900px) {
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    .header-content {
        padding: 1.5rem 0;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .main {
        padding: 1.5rem 0 2rem;
    }

    .card-header, .card-content {
        padding: 1rem;
    }

    .card-header {
        flex-direction: row;
        gap: 0.5rem;
    }

    .download-card,
    .progress-card,
    .log-card {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    .features {
        padding: 3rem 0;
    }

    .features-content {
        padding: 0 0.5rem;
    }

    .features-title {
        font-size: 1.5rem;
        margin-bottom: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .feature-card {
        padding: 1.5rem;
    }

    .btn-lg {
        width: 100%;
    }
}
