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

:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #7209b7;
    --accent: #f72585;
    --success: #4cc9f0;
    --danger: #f72585;
    --warning: #f8961e;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --light-gray: #e9ecef;
    --border-radius: 12px;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Dark theme variables */
[data-theme="dark"] {
    --light: #1a1a2e;
    --dark: #f8f9fa;
    --gray: #adb5bd;
    --light-gray: #2d3748;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    z-index: 1001;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* Header */
.header {
    background: var(--light);
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
}

.logo i {
    color: var(--primary);
    font-size: 28px;
}

.logo h1 {
    font-weight: 700;
    font-size: 1.8rem;
}

.logo span {
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--gray);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dark-mode-toggle {
    background: var(--light-gray);
    color: var(--dark);
    border: none;
    padding: 8px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    transition: var(--transition);
}

.dark-mode-toggle:hover {
    background: var(--primary);
    color: white;
}

[data-theme="dark"] .dark-mode-toggle {
    background: #2d3748;
    color: white;
}

[data-theme="dark"] .github-btn {
    background: var(--primary);
    color: white;
}
.github-btn {
    background: var(--dark);
    color: white;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.github-btn:hover {
    background: #343a40;
    transform: translateY(-2px);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--dark);
    cursor: pointer;
}

/* Keyboard Help */
.keyboard-help {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--light);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    z-index: 1001;
    padding: 20px;
    max-width: 500px;
    border: 2px solid var(--primary);
}

.keyboard-help-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.keyboard-help h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.shortcut-item kbd {
    background: var(--light-gray);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    border: 1px solid var(--gray);
}

/* Hero Section */
.hero {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100"><path fill="white" fill-opacity="0.1" d="M0,100 C250,0 500,0 750,100 C1000,0 1250,0 1500,100 L1500,0 L0,0 Z"/></svg>');
    background-size: cover;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-text h2 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
}

.highlight {
    color: var(--accent);
    position: relative;
    display: inline-block;
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    z-index: -1;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

.paper-counter {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat i {
    font-size: 2rem;
    color: var(--accent);
}

.stat h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.stat p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.hero-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.built-by {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.built-by p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.developer-link {
    color: white;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

.developer-link:hover {
    color: var(--accent);
}

.hero-image {
    position: relative;
}

.floating-card {
    background: var(--light);
    color: var(--dark);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    position: relative;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.floating-card i {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 15px;
}

.floating-card p {
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-style: italic;
}

.user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user h4 {
    font-size: 1rem;
    margin-bottom: 2px;
}

.user p {
    font-size: 0.9rem;
    color: var(--gray);
    margin: 0;
}

/* Tool Section */
.tool-section {
    padding: 80px 0;
    background: var(--light);
}

.tool-container {
    background: var(--light);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    margin-top: -100px;
    position: relative;
    z-index: 2;
    border: 1px solid var(--light-gray);
}

.tool-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.tool-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.8rem;
}

.tool-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.keyboard-help-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.keyboard-help-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.tool-tabs {
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 50px;
}

.tab-btn {
    background: none;
    border: none;
    color: white;
    padding: 10px 25px;
    border-radius: 50px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn.active {
    background: white;
    color: var(--primary);
}

.tab-content {
    padding: 40px;
    display: none;
}

.tab-content.active {
    display: block;
}

/* Input Tab */
.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.input-type-selector {
    display: flex;
    gap: 10px;
    background: var(--light-gray);
    padding: 5px;
    border-radius: var(--border-radius);
}

.input-type-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    border-radius: calc(var(--border-radius) - 5px);
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.input-type-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--box-shadow);
}

.input-stats {
    display: flex;
    gap: 20px;
    color: var(--gray);
    font-size: 0.9rem;
}

/* Input Methods */
.input-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.method-card {
    background: var(--light);
    border-radius: var(--border-radius);
    padding: 30px;
    border: 2px solid var(--light-gray);
    transition: var(--transition);
}

.method-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.method-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.method-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.method-card p {
    color: var(--gray);
    margin-bottom: 20px;
}

#paperInput {
    width: 100%;
    height: 200px;
    padding: 20px;
    border: 2px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    resize: vertical;
    transition: var(--transition);
    background: var(--light);
    color: var(--dark);
}

#paperInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.input-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    color: var(--gray);
}

.file-upload-area {
    border: 2px dashed var(--light-gray);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.05);
}

.file-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
}

.file-upload-area i {
    font-size: 3rem;
    color: var(--gray);
    margin-bottom: 15px;
}

.file-btn {
    background: var(--primary);
    color: white;
    padding: 10px 25px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: inline-block;
    margin: 15px 0;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    font-family: 'Poppins', sans-serif;
}

.file-btn:hover {
    background: var(--primary-dark);
}

.file-hint {
    color: var(--gray);
    font-size: 0.9rem;
}

#fileInput {
    display: none;
}

#fileInfo {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.clear-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 50%;
    transition: var(--transition);
}

.clear-btn:hover {
    background: rgba(247, 37, 133, 0.1);
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary, .btn-outline {
    padding: 15px 30px;
    border-radius: var(--border-radius);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    border: none;
    min-height: 54px;
    min-width: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(67, 97, 238, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--gray);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--light-gray);
    color: var(--gray);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-small {
    padding: 8px 20px;
    border-radius: var(--border-radius);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Results Tab */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
}

.result-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.export-format select {
    padding: 10px 15px;
    border-radius: var(--border-radius);
    border: 2px solid var(--light-gray);
    background: var(--light);
    color: var(--dark);
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
}

.stats-bar {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.stat-item i {
    font-size: 1.2rem;
}

.stat-item:nth-child(1) i { color: var(--success); }
.stat-item:nth-child(2) i { color: var(--danger); }
.stat-item:nth-child(3) i { color: var(--primary); }
.stat-item:nth-child(4) i { color: var(--secondary); }

.results-container {
    background: var(--light);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 2px solid var(--light-gray);
}

.results-tabs {
    display: flex;
    background: var(--light-gray);
    padding: 5px;
    border-bottom: 2px solid var(--light-gray);
}

.results-tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.results-tab-btn.active {
    background: white;
    color: var(--primary);
}

.results-content {
    position: relative;
}

.result-view {
    display: none;
    padding: 20px;
}

.result-view.active {
    display: block;
}

#bibtexOutput {
    padding: 30px;
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    line-height: 1.8;
    background: var(--light);
    color: var(--dark);
    max-height: 500px;
    overflow-y: auto;
    margin: 0;
    white-space: pre-wrap;
    border-radius: var(--border-radius);
}

.citation-preview {
    padding: 20px;
}

.preview-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.citation-item {
    background: var(--light-gray);
    padding: 20px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary);
}

.citation-item h4 {
    margin-bottom: 10px;
    color: var(--primary);
}

.citation-item .authors {
    color: var(--gray);
    font-style: italic;
    margin-bottom: 5px;
}

.citation-item .journal {
    color: var(--gray);
    font-size: 0.9rem;
}

.progress-container {
    padding: 20px;
    background: var(--light);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.progress-header h4 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    height: 10px;
    background: var(--light-gray);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.current-paper {
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    color: var(--gray);
    padding: 10px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

.retry-queue {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(248, 150, 30, 0.1);
    border-radius: var(--border-radius);
    color: var(--warning);
    font-size: 0.9rem;
}

/* History Tab */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.history-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
}

.history-actions {
    display: flex;
    gap: 15px;
}

.history-stats {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.history-container {
    background: var(--light);
    border-radius: var(--border-radius);
    border: 2px solid var(--light-gray);
    min-height: 300px;
}

.history-list {
    padding: 20px;
}

.empty-history {
    text-align: center;
    padding: 40px;
    color: var(--gray);
}

.empty-history i {
    margin-bottom: 20px;
    opacity: 0.5;
}

.history-item {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-item-title {
    font-weight: 600;
    color: var(--primary);
}

.history-item-date {
    color: var(--gray);
    font-size: 0.9rem;
}

.history-item-preview {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    background: var(--light);
    padding: 10px;
    border-radius: var(--border-radius);
    margin-top: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Settings Tab */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.setting-card {
    background: var(--light);
    border-radius: var(--border-radius);
    padding: 25px;
    border: 2px solid var(--light-gray);
}

.setting-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.setting-card h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.setting-card p {
    color: var(--gray);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    background: var(--light-gray);
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

#userEmail {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-family: 'Poppins', sans-serif;
    margin-bottom: 10px;
    background: var(--light);
    color: var(--dark);
}

#userEmail:focus {
    outline: none;
    border-color: var(--primary);
}

.radio-group, .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-group label, .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

input[type="radio"], input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid var(--light-gray);
}

/* Features Section */
.features {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--light) 0%, var(--light-gray) 100%);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 50px;
    color: var(--dark);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.feature-card {
    background: var(--light);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-10px);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.feature-icon i {
    font-size: 2rem;
    color: white;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

/* How To Section */
.how-to {
    padding: 80px 0;
    background: var(--light);
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.step {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.step-content code {
    background: var(--light-gray);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    font-family: 'Roboto Mono', monospace;
    display: block;
    margin-top: 15px;
    white-space: pre-wrap;
    color: var(--dark);
}

.step-image {
    background: var(--light-gray);
    padding: 20px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.step-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* API Info Section */
.api-info {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--light) 0%, var(--light-gray) 100%);
}

.api-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.api-card {
    background: var(--light);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
}

.api-card.crossref {
    border-top: 5px solid var(--primary);
}

.api-card.arxiv {
    border-top: 5px solid #b31b1b;
}

.api-card.semantic {
    border-top: 5px solid #185adb;
}

.api-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.api-header i {
    font-size: 2rem;
}

.api-card.crossref .api-header i { color: var(--primary); }
.api-card.arxiv .api-header i { color: #b31b1b; }
.api-card.semantic .api-header i { color: #185adb; }

.api-badge {
    background: var(--light-gray);
    color: var(--gray);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.api-card ul {
    list-style: none;
    margin: 20px 0;
}

.api-card li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.api-card li i {
    color: var(--success);
}

.api-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    margin-top: 20px;
}

/* Footer */
.footer {
    background: var(--dark);
    color: white;
    padding: 60px 0 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 60px;
    margin-bottom: 40px;
}
[data-theme="dark"] .footer-logo {
    background: var(--primary dark);
    color: black;
}

.footer-logo i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.footer-logo h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.footer-logo span {
    color: var(--primary);
}

.app-version {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #adb5bd;
}

.offline-status {
    display: flex;
    align-items: center;
    gap: 5px;
}

.offline-status.online {
    color: var(--success);
}

.offline-status.offline {
    color: var(--warning);
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.footer-column h4 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--light);
}

.footer-column a {
    color: #adb5bd;
    text-decoration: none;
    display: block;
    margin-bottom: 10px;
    transition: var(--transition);
}

.footer-column a:hover {
    color: white;
    transform: translateX(5px);
}

.developer-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 30px;
    margin: 40px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .developer-section {
    background: var(--light);
    color: white;
}

.developer-card {
    display: flex;
    align-items: center;
    gap: 25px;
}

.developer-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

.developer-info {
    flex: 1;
}

.developer-info h4 {
    color: white;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.developer-info p {
    color: #adb5bd;
    margin-bottom: 15px;
    font-size: 0.95rem;
}
[data-theme="dark"] .developer-info h4 {
    color: white;
}

.developer-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
[data-theme="dark"] .btn-portfolio {
    color: white;

}
[data-theme="light"] .btn-portfolio {
    color: white;
}

.newsletter-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    margin: 30px 0;
}
[data-theme="dark"] .newsletter-section {
    background: #2d3748;
    color: white;
}

.newsletter-section h4 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.newsletter-section form {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 20px auto;
}

.newsletter-section input {
    flex: 1;
    padding: 12px;
    border-radius: var(--border-radius);
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.newsletter-section input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.newsletter-section small {
    color: #adb5bd;
    font-size: 0.8rem;
    display: block;
    margin-top: 10px;
}

.footer-bottom {
    border-top: 1px solid #495057;
    padding-top: 30px;
    text-align: center;
    color: #adb5bd;
    font-size: 0.9rem;
}

.footer-bottom i {
    color: var(--accent);
    margin: 0 5px;
}

/* Portfolio Badge */
.portfolio-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

.portfolio-badge a {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    font-weight: 500;
}

.portfolio-badge a:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Dark Mode Toggle Floating */
.dark-mode-toggle-floating {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 100;
    background: var(--primary);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.dark-mode-toggle-floating:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

/* Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 400px;
    background: var(--light);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    z-index: 1000;
    border: 2px solid var(--primary);
}

.install-prompt-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.install-prompt i {
    font-size: 2rem;
    color: var(--primary);
}

.install-prompt h4 {
    margin-bottom: 5px;
}

.install-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--light);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 30px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--light);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--primary); }

.toast i {
    font-size: 1.5rem;
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.warning i { color: var(--warning); }
.toast.info i { color: var(--primary); }

/* Responsive Design */
@media (max-width: 1200px) {
    .api-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-stats {
        grid-template-columns: 1fr;
        max-width: 300px;
        margin: 0 auto 30px;
    }

    .input-methods {
        grid-template-columns: 1fr;
    }

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

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .api-cards {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .footer-links {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        background: var(--light);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--box-shadow);
        gap: 0;
        z-index: 1000;
    }

    .nav-links.show {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 15px;
        border-bottom: 1px solid var(--light-gray);
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
        padding-top: 20px;
        border-top: 1px solid var(--light-gray);
    }

    .menu-toggle {
        display: block;
    }

    .hero-text h2 {
        font-size: 2.5rem;
    }

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

    .footer-links {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .tool-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .results-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .result-actions {
        width: 100%;
        justify-content: center;
    }

    .stats-bar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .history-header {
        flex-direction: column;
        text-align: center;
    }

    .developer-card {
        flex-direction: column;
        text-align: center;
    }

    .developer-links {
        justify-content: center;
    }

    .newsletter-section form {
        flex-direction: column;
    }

    .portfolio-badge a span {
        display: none;
    }

    .portfolio-badge a {
        padding: 15px;
        border-radius: 50%;
        width: 50px;
        height: 50px;
    }

    .dark-mode-toggle-floating {
        bottom: 140px;
    }

    .install-prompt {
        max-width: calc(100% - 40px);
    }

    .install-prompt-content {
        flex-direction: column;
        text-align: center;
    }

    .install-actions {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero {
        padding: 40px 0;
    }

    .hero-text h2 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .step {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .step-number {
        margin: 0 auto;
    }

    .tool-section {
        padding: 40px 0;
    }

    .tab-content {
        padding: 20px;
    }

    .btn-primary, .btn-secondary, .btn-outline {
        padding: 15px;
        font-size: 14px;
        justify-content: center;
        min-height: 44px;
    }

    .github-text {
        display: none;
    }

    .github-btn {
        padding: 10px 15px;
    }

    .toggle-text {
        display: none;
    }

    .dark-mode-toggle {
        padding: 8px;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        justify-content: center;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    button, .nav-link, .tab-btn, .file-btn, .input-type-btn, .results-tab-btn {
        min-height: 44px;
        min-width: 44px;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }

    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }

    .clear-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* File input styling */
#fileInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

/* Prevent text selection on interactive elements */
button, .nav-link, .tab-btn, .file-btn, .input-type-btn, .results-tab-btn {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Improve focus states for accessibility */
button:focus,
input:focus,
textarea:focus,
select:focus,
.nav-link:focus,
.tab-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Loading animations */
.fa-spinner, .fa-sync {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* File info styling */
.file-info-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.file-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-count {
    font-size: 12px;
    color: var(--gray);
}

/* Typing indicator */
.typing-indicator {
    display: inline-block;
    width: 4px;
    height: 4px;
    background-color: var(--primary);
    border-radius: 50%;
    animation: typing 1.5s infinite;
    margin-left: 2px;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--light-gray) 25%, var(--gray) 50%, var(--light-gray) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Badge for new features */
.badge-new {
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: super;
}

/* Print styles */
@media print {
    .header, .footer, .portfolio-badge, .dark-mode-toggle-floating, .install-prompt {
        display: none !important;
    }

    .tool-section {
        padding: 0;
        margin: 0;
    }

    .tool-container {
        box-shadow: none;
        border: none;
        margin: 0;
    }

    #bibtexOutput {
        max-height: none;
        overflow: visible;
        white-space: normal;
    }

    body {
        background: white !important;
        color: black !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary: #0000ff;
        --secondary: #800080;
        --accent: #ff0000;
        --success: #008000;
        --danger: #ff0000;
        --warning: #ffa500;
        --light: #ffffff;
        --dark: #000000;
        --gray: #808080;
        --light-gray: #f0f0f0;
    }

    .btn-primary, .btn-secondary, .btn-outline {
        border: 2px solid var(--dark);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .floating-card {
        animation: none;
    }
}

/* ===========================
   QR CODE MODAL STYLES
   =========================== */

/* App Detection */
.app-detection {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--border-radius);
}

.detection-content {
    text-align: center;
    padding: 40px;
    max-width: 400px;
}

.detection-content i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.detection-content h4 {
    margin-bottom: 10px;
    color: var(--primary);
}

.detection-content p {
    color: var(--gray);
    margin-bottom: 20px;
}

/* QR Display */
.qr-display {
    transition: opacity 0.3s ease;
}

/* Payment Options Tabs */
.payment-options {
    display: flex;
    gap: 10px;
    background: var(--light-gray);
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.payment-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    border-radius: calc(var(--border-radius) - 5px);
    background: transparent;
    border: none;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.payment-option i {
    font-size: 1.5rem;
}

.payment-option[data-payment="alipay"] i {
    color: #00a1e9;
}

.payment-option[data-payment="wechat"] i {
    color: #07c160;
}

.payment-option.active {
    background: white;
    box-shadow: var(--box-shadow);
}

/* QR Content */
.qr-section {
    display: none;
}

.qr-section.active {
    display: block;

}
[data-theme="dark"] .payment-option.active {
    color: black;
}

.qr-image-container {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 0 auto 30px;
    cursor: pointer;
    border: 10px solid white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.qr-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
}

.qr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qr-image-container:hover .qr-overlay {
    opacity: 1;
}

.qr-overlay i {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* QR Instructions */
.qr-instructions {
    background: var(--light-gray);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.qr-instructions h5 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: var(--primary);
}

.qr-instructions ol {
    margin-left: 20px;
    margin-bottom: 20px;
}

.qr-instructions li {
    margin-bottom: 8px;
    color: var(--gray);
}

.qr-instructions code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9em;
}

.qr-mobile-action {
    text-align: center;
    margin-top: 20px;
}

.qr-mobile-action button {
    width: 100%;
    max-width: 300px;
}

/* QR Footer */
.qr-footer {
    text-align: center;
}

.support-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(67, 97, 238, 0.1);
    border-radius: var(--border-radius);
    color: var(--primary);
}

.support-note i {
    color: var(--accent);
}

.qr-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Enlargement Modal */
.modal-content.fullscreen {
    max-width: 90%;
    max-height: 90%;
}

.enlarge-container {
    text-align: center;
    padding: 20px;
}

.enlarge-container img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border: 15px solid white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.enlarge-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .qr-image-container {
        width: 200px;
        height: 200px;
    }

    .payment-options {
        flex-direction: column;
    }

    .payment-option {
        padding: 12px;
    }

    .qr-actions {
        flex-direction: column;
    }

    .qr-instructions {
        padding: 15px;
    }

    .enlarge-container img {
        max-height: 50vh;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .qr-image-container {
        width: 220px;
        height: 220px;
    }
}

/* Animation for app detection */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.app-detection .detection-content i {
    animation: pulse 2s infinite;
}

/* Loading state for QR */
.qr-image.loading {
    opacity: 0.5;
}

/* Hide qr-display when detection is active */
.app-detection:not(.hidden) ~ .qr-display {
    opacity: 0.5;
    pointer-events: none;
}
/* ===========================
   MOBILE QR CODE OPTIMIZATION
   =========================== */

/* Mobile-specific QR modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 10px;
    }

    .qr-content {
        flex-direction: column;
    }

    .qr-section.active {
        flex-direction: column;
    }

    .qr-image-container {
        width: 200px;
        height: 200px;
        margin: 0 auto 20px;
    }

    .qr-instructions {
        padding: 15px;
    }

    .qr-instructions ol {
        font-size: 14px;
    }

    .payment-options {
        flex-direction: column;
        gap: 8px;
    }

    .payment-option {
        padding: 12px;
        font-size: 14px;
    }

    .mobile-note {
        background: rgba(67, 97, 238, 0.1);
        padding: 10px;
        border-radius: 8px;
        font-size: 13px;
        margin-top: 15px;
        display: flex;
        align-items: center;
        gap: 8px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .qr-image-container {
        width: 220px;
        height: 220px;
        border-width: 15px;
    }

    .payment-option,
    #openAlipay,
    #openWeChat,
    #saveQR {
        min-height: 50px;
        min-width: 50px;
        font-size: 16px;
    }

    .modal-close {
        width: 44px;
        height: 44px;
        font-size: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* High-contrast mode for accessibility */
@media (prefers-contrast: high) {
    .qr-overlay {
        background: rgba(0, 0, 0, 0.9);
    }

    .qr-image-container {
        border: 3px solid black;
    }
}

/* Landscape orientation optimization */
@media (max-height: 600px) and (orientation: landscape) {
    .modal-content {
        max-height: 85vh;
        overflow-y: auto;
    }

    .qr-image-container {
        width: 150px;
        height: 150px;
    }

    .qr-instructions ol {
        font-size: 12px;
    }
}

/* iOS specific adjustments */
@supports (-webkit-touch-callout: none) {
    .qr-image-container {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .modal-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Android Chrome pull-to-refresh prevention */
@media (hover: none) and (pointer: coarse) {
    body.menu-open {
        overscroll-behavior: none;
    }
}