/* CSS Custom Properties for theming */
:root {
    /* Light theme (default) */
    --bg-primary: #f8f9fa;
    --bg-secondary: white;
    --bg-accent: #e8f5e8;
    --text-primary: #333;
    --text-secondary: #2e7d32;
    --border-color: #4CAF50;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* Paste textarea styling */
#pasteContent {
    width: 100%;
    padding: clamp(12px, 3vw, 18px);
    font-size: clamp(14px, 4vw, 18px);
    line-height: 1.5;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-bottom: clamp(15px, 4vw, 25px);
    background-color: #f9f9f9;
    resize: vertical;
    box-sizing: border-box;
    min-height: clamp(200px, 50vw, 350px);
    color: var(--text-primary);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Dark theme variables */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-accent: #1e3a1e;
    --text-primary: #e0e0e0;
    --text-secondary: #81c784;
    --border-color: #66bb6a;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* Light theme variables (explicit override for OS dark mode users) */
[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: white;
    --bg-accent: #e8f5e8;
    --text-primary: #333;
    --text-secondary: #2e7d32;
    --border-color: #4CAF50;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* General body styling with mobile optimizations */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    text-align: center;
    margin: 0;
    padding: clamp(10px, 2vw, 20px);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-text-size-adjust: 100%; /* Prevent text scaling on iOS */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: clamp(14px, 2.5vw, 16px);
}

/* Main container styling */
.container {
    max-width: 1200px;
    margin: clamp(20px, 5vw, 50px) auto;
    background-color: var(--bg-secondary);
    padding: clamp(20px, 5vw, 50px) clamp(15px, 4vw, 50px);
    border-radius: clamp(8px, 2vw, 12px);
    box-shadow: 0 4px 12px var(--shadow);
    min-height: auto;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Heading styling */
h1 {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    color: var(--border-color);
    margin-bottom: clamp(20px, 4vw, 30px);
    transition: color 0.3s ease;
    line-height: 1.2;
}

/* Theme toggle button */
.theme-toggle {
    position: absolute;
    top: clamp(15px, 3vw, 20px);
    right: clamp(15px, 3vw, 20px);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: clamp(10px, 2vw, 16px);
    cursor: pointer;
    font-size: clamp(16px, 3vw, 18px);
    transition: all 0.3s ease;
    color: var(--text-primary);
    box-shadow: 0 2px 6px var(--shadow);
    min-width: 44px; /* Minimum touch target */
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--shadow);
}

/* Toggle button container */
.toggle-container {
    margin-bottom: clamp(20px, 4vw, 30px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 2vw, 15px);
    flex-wrap: wrap;
}

/* Inline expiry selection */
.expiry-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: clamp(8px, 2vw, 15px);
    padding: clamp(8px, 2vw, 12px);
    background-color: var(--bg-secondary);
    border-radius: clamp(6px, 1.5vw, 8px);
    border: 1px solid var(--border-color);
}

.expiry-inline .expiry-label {
    font-size: clamp(14px, 3vw, 16px);
    color: var(--text-secondary);
    margin: 0;
}

.expiry-select-inline {
    padding: clamp(4px, 1vw, 6px) clamp(8px, 2vw, 10px);
    font-size: clamp(12px, 2.5vw, 14px);
    border: 1px solid var(--border-color);
    border-radius: clamp(4px, 1vw, 6px);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 60px;
}

.custom-expiry-inline {
    padding: clamp(4px, 1vw, 6px) clamp(8px, 2vw, 10px);
    font-size: clamp(12px, 2.5vw, 14px);
    border: 1px solid var(--border-color);
    border-radius: clamp(4px, 1vw, 6px);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    margin-left: 6px;
}

/* Toggle button styling */
.toggle-button {
    padding: clamp(12px, 3vw, 20px) clamp(16px, 4vw, 24px);
    font-size: clamp(15px, 3vw, 16px);
    cursor: pointer;
    border: none;
    background-color: var(--bg-accent);
    color: var(--text-primary);
    border-radius: clamp(6px, 1.5vw, 8px);
    transition: all 0.3s ease;
    min-height: 44px; /* Minimum touch target */
    min-width: 100px;
    font-weight: 500;
    touch-action: manipulation; /* Optimize for touch */
}

.toggle-button.active {
    background-color: var(--border-color);
    color: white;
}

.toggle-button:hover {
    background-color: var(--border-color);
    color: white;
}

/* FAQ button styling */
.faq-button {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    margin-left: 10px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.faq-button:hover {
    background-color: #4CAF50;
    color: white;
}

/* Drag-and-drop area styling */
.drop-area {
    border: 2px dashed var(--border-color);
    padding: clamp(40px, 8vw, 90px);
    border-radius: clamp(8px, 2vw, 12px);
    background-color: var(--bg-accent);
    cursor: pointer;
    margin-bottom: clamp(20px, 4vw, 30px);
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
    min-height: clamp(120px, 20vw, 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.drop-area p {
    margin: 0;
    font-size: clamp(16px, 3.5vw, 18px);
    font-weight: 500;
    pointer-events: none;
}

.drop-area.dragging {
    background-color: #e0e0e0;
    border-color: #999;
    transform: scale(1.02);
}

/* Hover effect when the user hovers over the drop area */
.drop-area:hover {
    background-color: #f0f0f0;
    border-color: #aaa;
}

/* Dark theme hover effect for drop area */
[data-theme="dark"] .drop-area:hover {
    background-color: #333333;
    border-color: #666666;
}

/* Clipboard paste visual feedback */
.drop-area.clipboard-active {
    background-color: #e8f5e8;
    border-color: #4CAF50;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

[data-theme="dark"] .drop-area.clipboard-active {
    background-color: #2d4a2d;
    border-color: #66bb6a;
}

/* Mobile-specific hint */
.mobile-hint {
    display: none;
    font-size: 0.9em;
    color: #666;
    margin-top: 0.5rem;
}

[data-theme="dark"] .mobile-hint {
    color: #999;
}

/* Mobile tutorial styling */
.mobile-tutorial {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.mobile-tutorial h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #495057;
}

.mobile-tutorial ol {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

.mobile-tutorial li {
    margin-bottom: 0.3rem;
}

[data-theme="dark"] .mobile-tutorial {
    background-color: #2d3748;
    border-color: #4a5568;
}

[data-theme="dark"] .mobile-tutorial h4 {
    color: #e2e8f0;
}

/* Mobile clipboard paste section */
.mobile-clipboard-section {
    display: none; /* Hidden by default, shown via JavaScript on mobile */
    margin: 20px 0;
    padding: 15px;
    background-color: var(--bg-accent);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.mobile-paste-button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
    margin-bottom: 8px;
    min-width: 200px;
}

.mobile-paste-button:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.mobile-paste-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.mobile-paste-hint {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    font-style: italic;
}

[data-theme="dark"] .mobile-paste-button {
    background: linear-gradient(135deg, #66bb6a, #5a9f5a);
    box-shadow: 0 2px 8px rgba(102, 187, 106, 0.3);
}

[data-theme="dark"] .mobile-paste-button:hover {
    background: linear-gradient(135deg, #5a9f5a, #4f8c4f);
    box-shadow: 0 4px 12px rgba(102, 187, 106, 0.4);
}

/* Clipboard notification/toast */
.clipboard-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideInToast 0.3s ease-out;
    font-size: 14px;
    max-width: 300px;
}

[data-theme="dark"] .clipboard-toast {
    background: #66bb6a;
    color: #1a1a1a;
}

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

/* FAQ keyboard shortcut styling */
kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
    box-shadow: 0 1px 2px var(--shadow);
}

[data-theme="dark"] kbd {
    background: #404040;
    border-color: #666;
    color: var(--text-primary);
}

/* Hidden file input */
#fileInput {
    display: none;
}

/* Progress bar container styling */
.progress-bar {
    width: 100%;
    background: #e0e0e0; /* Light grey background for unfilled area */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin: clamp(15px, 4vw, 25px) 0;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    height: clamp(36px, 8vw, 48px);
}

/* Dark theme progress bar background */
[data-theme="dark"] .progress-bar {
    background: #404040; /* Darker grey for dark theme */
}

.progress {
    height: 100%;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 50%, #66bb6a 100%);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-radius: 11px; /* Slightly smaller radius to fit inside container */
    overflow: hidden;
    z-index: 2; /* Ensure it's above the background */
}

.progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3) 50%,
        transparent
    );
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#progressText {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(12px, 3.5vw, 16px);
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    z-index: 10;
    margin: 0;
    width: 100%;
    text-align: center;
}

/* Styling for result messages (uploaded files or errors) */
.result-message {
    margin-top: 20px;
    font-size: 18px;
    color: #333;
}

.result-message a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
}

.result-message a:hover {
    text-decoration: underline;
    color: #45a049;
}

/* Uploaded file list styling */
.uploaded-file {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.uploaded-file a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
}

.uploaded-file a:hover {
    text-decoration: underline;
    color: #45a049;
}

/* Thumbnail styling for previews */
.thumbnail-small {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ddd;
}

/* Pastebin textarea styling */
#pasteContent {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 20px;
    background-color: #f9f9f9;
    resize: vertical;
    box-sizing: border-box;
    min-height: 300px; /* Increase the minimum height */
    color: var(--text-primary);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Dark theme styling for paste textarea */
[data-theme="dark"] #pasteContent {
    background-color: var(--bg-secondary);
    border-color: #555555;
    color: var(--text-primary);
}

/* Submit button styling */
.submit-button {
    padding: clamp(12px, 3vw, 16px) clamp(20px, 5vw, 32px);
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-size: clamp(14px, 4vw, 18px);
    font-weight: 600;
    min-height: 44px;
    min-width: 88px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.submit-button:hover {
    background-color: #45a049;
    transform: translateY(-1px);
}

.submit-button:active {
    transform: translateY(0);
}

/* Raw view and button for view_paste.html */
pre {
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    padding: clamp(12px, 4vw, 24px);
    border-radius: 8px;
    text-align: left;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: clamp(12px, 3.5vw, 16px);
    line-height: 1.6;
    overflow-x: auto;
    max-width: 100%;
    box-sizing: border-box;
}

/* Button container and button styling */
.button-container {
    margin-top: clamp(15px, 4vw, 25px);
    display: flex;
    flex-wrap: wrap;
    gap: clamp(8px, 2vw, 12px);
    align-items: center;
    justify-content: flex-start;
}

/* Image preview styling */
.image-preview {
    margin: clamp(15px, 4vw, 20px) 0 !important;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: clamp(10px, 3vw, 15px) !important;
    background: #f9f9f9 !important;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

/* File result bar layout - horizontal layout */
.file-result-bar {
    display: flex !important;
    align-items: center !important;
    gap: clamp(10px, 2.5vw, 15px) !important;
    flex-wrap: wrap !important;
    padding: clamp(12px, 3vw, 18px) !important;
    margin-bottom: clamp(12px, 3vw, 18px) !important;
    border: 2px solid #4CAF50 !important;
    border-radius: 8px !important;
    background-color: #f0f8f0 !important;
}

.file-info-section {
    flex: 1 !important;
    min-width: 160px !important;
}

.file-info-section .file-name {
    font-weight: bold !important;
    margin-bottom: 4px !important;
}

.file-info-section .file-size {
    font-size: clamp(12px, 3vw, 14px) !important;
    color: #666 !important;
}

.file-buttons-section {
    display: flex !important;
    gap: clamp(6px, 1.5vw, 10px) !important;
    flex-wrap: wrap !important;
}

.file-buttons-section button {
    padding: clamp(6px, 1.5vw, 8px) clamp(8px, 2vw, 12px) !important;
    font-size: clamp(11px, 2.5vw, 13px) !important;
}

.file-thumbnail {
    width: clamp(50px, 12vw, 70px) !important;
    height: clamp(50px, 12vw, 70px) !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    border: 1px solid #ddd !important;
    flex-shrink: 0 !important;
}

.image-preview img {
    max-width: 100% !important;
    max-height: clamp(120px, 30vw, 200px) !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    object-fit: contain !important;
    transition: transform 0.2s ease;
}

.image-preview img:hover {
    transform: scale(1.02);
}

/* Dark theme image preview */
[data-theme="dark"] .image-preview {
    background: #2d2d2d !important;
    border-color: #555555;
}

[data-theme="dark"] .image-preview img {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.button:hover {
    background-color: #45a049;
}

/* Raw link styling */
.raw-link {
    display: block;
    margin-top: 10px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
}

.raw-link:hover {
    text-decoration: underline;
}

/* Dark theme styling using prefers-color-scheme (only when no explicit theme is set) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --bg-accent: #1e3a1e;
        --text-primary: #e0e0e0;
        --text-secondary: #81c784;
        --border-color: #66bb6a;
        --shadow: rgba(0, 0, 0, 0.3);
    }
}

/* Media query for mobile responsiveness */
/* Enhanced mobile responsiveness */
@media only screen and (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .container {
        margin: 20px auto;
        padding: 20px 15px;
        border-radius: 8px;
        min-height: auto;
        box-shadow: 0 2px 8px var(--shadow);
    }

    h1 {
        font-size: 2.2em;
        margin-bottom: 20px;
        line-height: 1.2;
    }

    /* Show mobile hint on smaller screens */
    .mobile-hint {
        display: block;
    }

    /* Theme toggle - better mobile positioning */
    .theme-toggle {
        top: 15px;
        right: 15px;
        padding: 10px 14px;
        font-size: 18px;
        border-radius: 25px;
        min-width: 60px;
    }

    /* Toggle buttons - stack vertically on very small screens */
    .toggle-container {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 25px;
    }

    .toggle-button {
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 8px;
        width: 100%;
        max-width: 200px;
        margin: 0;
        touch-action: manipulation; /* Prevent double-tap zoom */
    }

    /* Mobile expiry inline styles */
    .expiry-inline {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
        max-width: 200px;
        justify-content: center;
        padding: 10px;
    }

    .expiry-select-inline {
        min-width: 70px;
        font-size: 14px;
    }

    /* Drop area improvements */
    .drop-area {
        padding: 40px 20px;
        border-radius: 8px;
        border: 3px dashed var(--border-color);
        margin: 20px 0;
        min-height: 120px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .drop-area p {
        font-size: 16px;
        margin: 8px 0;
        line-height: 1.4;
    }

    /* File input styling for mobile */
    .file-input-wrapper {
        margin: 15px 0;
    }

    .file-input-wrapper input[type="file"] {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        border: 2px solid var(--border-color);
        border-radius: 8px;
        background: var(--bg-secondary);
        color: var(--text-primary);
    }

    /* Progress bar enhancements */
    .progress {
        border-radius: 11px; /* Match the main style */
    }

    .progress-bar {
        border-radius: 12px;
        background: #e0e0e0; /* Consistent background */
    }
    
    /* Dark theme mobile progress bar */
    [data-theme="dark"] .progress-bar {
        background: #404040;
    }

    #progressText {
        font-size: 15px;
        padding: 8px;
        font-weight: 500;
    }

    /* Textarea improvements */
    #pasteContent {
        font-size: 16px;
        padding: 15px;
        border-radius: 8px;
        border: 2px solid var(--border-color);
        min-height: 150px;
        resize: vertical;
        line-height: 1.4;
        font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    }

    /* Button improvements */
    button {
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 8px;
        border: none;
        cursor: pointer;
        touch-action: manipulation;
        min-height: 48px; /* Touch target size */
        margin: 5px;
        transition: all 0.2s ease;
    }

    button:hover, button:focus {
        transform: translateY(-1px);
        box-shadow: 0 4px 8px var(--shadow);
    }

    button:active {
        transform: translateY(0);
    }

    /* Results display */
    #result {
        margin-top: 25px;
        padding: 15px;
        border-radius: 8px;
        font-size: 15px;
    }

    /* Share buttons in results */
    .share-button, .view-button, .qr-button {
        padding: clamp(10px, 2.5vw, 14px) clamp(16px, 4vw, 20px) !important;
        font-size: clamp(12px, 3.5vw, 16px) !important;
        margin: clamp(3px, 1vw, 6px);
        border-radius: 8px;
        min-width: clamp(100px, 25vw, 130px);
        min-height: 44px;
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    /* Code blocks */
    pre {
        font-size: 14px;
        padding: 15px;
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    code {
        font-size: 14px;
        word-break: break-word;
    }
}

/* Specific optimizations for very small screens */
@media only screen and (max-width: 480px) {
    .container {
        margin: 10px auto;
        padding: 15px 10px;
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 15px;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 16px;
    }

    .drop-area {
        padding: 30px 15px;
        min-height: 100px;
    }

    .drop-area p {
        font-size: 15px;
    }

    .toggle-button {
        padding: 10px 16px;
        font-size: 15px;
    }

    #pasteContent {
        min-height: 120px;
        padding: 12px;
    }

    .progress {
        border-radius: 10px; /* Slightly smaller for very small screens */
    }
    
    .progress-bar {
        background: #e0e0e0;
    }
    
    [data-theme="dark"] .progress-bar {
        background: #404040;
    }

    #progressText {
        font-size: 14px;
    }

    .thumbnail-small {
        width: 40px;
        height: 40px;
    }
}

/* QR Code button styling */
.qr-button {
    padding: clamp(10px, 2.5vw, 14px) clamp(15px, 4vw, 20px) !important;
    background-color: #9C27B0 !important;
    color: white !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: clamp(12px, 3.5vw, 16px);
    font-weight: 600;
    min-height: 44px;
    min-width: 88px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.qr-button:hover {
    background-color: #7B1FA2 !important;
    transform: translateY(-1px);
}

/* Paste and File Viewing Styles */
.paste-container, .file-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 20px 0;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.paste-header, .file-header {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.paste-header h3, .file-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.paste-actions, .file-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.copy-button, .raw-button, .download-button, .home-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.copy-button {
    background: #4CAF50;
    color: white;
}

.copy-button:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.raw-button {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.raw-button:hover {
    background: var(--text-secondary);
    color: var(--bg-primary);
}

.download-button {
    background: #2196F3;
    color: white;
}

.download-button:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.home-button {
    background: var(--text-secondary);
    color: var(--bg-primary);
}

.home-button:hover {
    background: var(--text-primary);
    transform: translateY(-1px);
}

.paste-content {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.paste-content pre {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.file-info {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.file-info p {
    margin: 5px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.file-preview {
    padding: 20px;
}

.file-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-preview pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* Enhanced responsive design for viewing pages */
@media (max-width: 768px) {
    .paste-header, .file-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 15px;
    }
    
    .paste-actions, .file-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .paste-actions button, .file-actions button {
        min-width: 140px;
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .paste-content, .file-preview {
        padding: 20px 15px;
        border-radius: 8px;
        margin: 15px 0;
    }
    
    .paste-content pre {
        font-size: 14px;
        line-height: 1.4;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .file-preview img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }
    
    .file-info {
        margin: 15px 0;
        padding: 15px;
        background: var(--bg-accent);
        border-radius: 8px;
    }
    
    .file-info p {
        margin: 8px 0;
        font-size: 15px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* This targets touch devices */
    
    button, .toggle-button, .theme-toggle {
        min-height: 44px; /* iOS recommended touch target */
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    button:hover, .toggle-button:hover, .theme-toggle:hover {
        transform: none;
    }
    
    /* Better active states for touch */
    button:active, .toggle-button:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
    
    /* Improve scrollable areas */
    .paste-content, #pasteContent, pre {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* Landscape phone optimizations */
@media only screen and (max-width: 896px) and (orientation: landscape) {
    .container {
        margin: 15px auto;
        padding: 20px 25px;
    }
    
    h1 {
        font-size: 2em;
        margin-bottom: 15px;
    }
    
    .toggle-container {
        flex-direction: row;
        justify-content: center;
        margin-bottom: 20px;
    }
    
    .toggle-button {
        width: auto;
        margin: 0 5px;
    }
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 8px 0;
    min-width: 180px;
}

[data-theme="dark"] .context-menu {
    background: var(--bg-secondary);
    border-color: #555;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.context-menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

.context-menu-item:hover {
    background-color: #f0f0f0;
}

[data-theme="dark"] .context-menu-item:hover {
    background-color: #333;
}

.context-menu-item:active {
    background-color: #e0e0e0;
}

[data-theme="dark"] .context-menu-item:active {
    background-color: #444;
}

/* Expiry Section Styles */
.expiry-section {
    margin: 20px 0;
    padding: 15px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid #2196F3;
}

.expiry-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.expiry-select, .custom-expiry {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

.expiry-select:focus, .custom-expiry:focus {
    outline: none;
    border-color: #2196F3;
}

[data-theme="dark"] .expiry-select,
[data-theme="dark"] .custom-expiry {
    background-color: var(--bg-primary);
    border-color: #555;
    color: var(--text-primary);
}

[data-theme="dark"] .expiry-select:focus,
[data-theme="dark"] .custom-expiry:focus {
    border-color: #2196F3;
}

.expiry-hint {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.custom-expiry {
    margin-top: 10px;
    transition: opacity 0.3s ease;
}

/* Mobile expiry section adjustments */
@media only screen and (max-width: 768px) {
    .expiry-section {
        margin: 15px 0;
        padding: 12px;
    }
    
    .expiry-select, .custom-expiry {
        max-width: 100%;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Mobile/Desktop specific visibility */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

/* Show mobile-only content on mobile devices */
@media only screen and (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* URL Shortener Styles */
.url-input-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 25px;
}

.url-label {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.url-input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.url-input:focus {
    outline: none;
    border-color: #388e3c;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.url-options {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.option-group {
    flex: 1;
    min-width: 200px;
}

.option-label {
    display: block;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 14px;
}

.custom-code-input {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.custom-code-input:focus {
    outline: none;
    border-color: var(--border-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.url-expiry-select {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.option-hint {
    font-size: 12px;
    color: #666;
    margin-top: 3px;
    font-style: italic;
}

/* URL Preview Container */
.url-preview-container {
    background-color: var(--bg-accent);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    animation: slideDown 0.3s ease-out;
}

.url-preview h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 18px;
}

.short-url-display {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.short-url-input {
    flex: 1;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.copy-button {
    padding: 12px 16px;
    font-size: 16px;
    background-color: var(--border-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.copy-button:hover {
    background-color: #388e3c;
    transform: translateY(-2px);
}

.url-details {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
}

.url-details p {
    margin: 8px 0;
}

.url-details strong {
    color: var(--text-secondary);
}

/* Responsive adjustments for URL shortener */
@media only screen and (max-width: 768px) {
    .url-options {
        flex-direction: column;
        gap: 15px;
    }
    
    .option-group {
        min-width: unset;
    }
    
    .short-url-display {
        flex-direction: column;
        gap: 10px;
    }
    
    .copy-button {
        align-self: stretch;
        text-align: center;
    }
}

/* Animation for URL preview */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
