/* Image Editor specific styles */

/* Format Support Card */
.format-support-card {
    margin: 2rem auto;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-width: 600px;
    text-align: center;
}

.formats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.format-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.format-title {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.format-list {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .formats-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .format-support-card {
        margin: 1.5rem auto;
        padding: 1rem;
    }
}

/* Custom Ko-fi button styling */
.custom-kofi-btn:hover {
    background: #475569 !important;
    transform: translateY(-1px);
}

/* Override global constraints for sidebar layout */
body main.tool-container {
    max-width: none;
    width: 100%;
    position: relative; /* Create positioning context for sticky sidebar */
}

/* Ensure the parent container can expand */
body div.container:has(main.tool-container) {
    max-width: none;
    width: 100%;
    padding: 0 2rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.upload-area.has-image {
    border-style: solid;
    border-color: var(--primary-color);
}

.image-toggle-controls {
    grid-column: 1 / -1;
    margin-bottom: 1rem;
    text-align: left;
}

.image-preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    transition: grid-template-columns 0.3s ease;
}

.image-preview-container.original-collapsed {
    grid-template-columns: 0fr 1fr !important;
}

.image-preview {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-preview.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: none !important;
    opacity: 0 !important;
    overflow: hidden !important;
}

.image-preview h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    box-shadow: var(--shadow-md);
}

/* New Editor Layout */
.editor-layout {
    margin-top: 2rem;
    width: 100%;
}

.editor-flex-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 2rem !important;
    min-height: 500px !important;
    width: 100% !important;
}

.extended-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2rem !important;
}

.sidebar-container {
    flex: 0 0 180px !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg-secondary) !important;
    padding: 1rem !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-color) !important;
    position: sticky !important;
    top: 6rem !important;
    align-self: flex-start !important;
    max-height: calc(100vh - 8rem) !important;
    overflow-y: auto !important;
}

.tabs-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.main-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2rem !important;
    min-width: 0 !important; /* Prevent flex item from overflowing */
    background: var(--bg-primary) !important;
}

.instructions-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.file-picker-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.file-picker-section h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.metadata-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.tab-btn {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.tab-btn:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

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

.tab-btn.disabled {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.tab-btn.disabled:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.operations-content {
    margin-top: 1rem;
}

.tabs-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.tab-content {
    display: none;
}

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

.operation-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.operation-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.operation-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.operation-queue {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.operation-queue h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.queue-item {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin: 0.25rem;
    font-size: 0.85rem;
}

.metadata-display {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-line;
}

.hidden {
    display: none;
}

/* Toggle Buttons */
.btn-toggle {
    padding: 0.25rem 0.75rem;
    background: var(--button-bg);
    color: var(--button-text);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s;
}

.btn-toggle:hover {
    background: var(--button-hover);
}

/* Applied Operations Section */
.applied-operations-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.applied-operations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.applied-operations-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Inline operation controls */
.operation-controls-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

/* Operation Tags */
.operation-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 2rem;
    align-items: center;
}

.operation-tag {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
}

.operation-tag-placeholder {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.85rem;
}

.btn-compact {
    padding: 0.25rem 0.5rem;
    background: var(--button-bg);
    color: var(--button-text);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-compact:hover:not(:disabled) {
    background: var(--button-hover);
}

.btn-compact:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Common Apply Button */
.common-apply-section {
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

.btn-apply {
    padding: 0.75rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-apply:hover:not(:disabled) {
    background: var(--primary-hover, var(--primary-color));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-apply:disabled {
    background: var(--surface-light);
    color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Enhanced buttons (used throughout operations) */
.btn-enhanced {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-enhanced:hover:not(:disabled) {
    background: var(--primary-hover, var(--primary-color));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-enhanced:disabled {
    background: var(--surface-light);
    color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Copy buttons */
.btn-copy {
    padding: 0.25rem 0.5rem;
    background: var(--button-bg);
    color: var(--button-text);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: var(--button-hover);
}

/* Initial Upload Section */
.initial-upload-section {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    margin: 2rem 0;
    transition: all 0.3s ease;
}

.initial-upload-section:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.upload-prompt h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.upload-prompt p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.btn-upload {
    padding: 0.75rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-upload:hover {
    background: var(--primary-hover, var(--primary-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Metadata Header */
.metadata-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.metadata-content.collapsed {
    display: none;
}

/* Image Header */
.image-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    white-space: nowrap;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.error-text {
    color: var(--error-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.success-text {
    color: var(--success-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Tablet Layout - 1024px and below */
@media (max-width: 1024px) {
    .editor-flex-container {
        flex-direction: column !important;
        gap: 1.5rem !important;
    }
    
    .sidebar-container {
        flex: none !important;
        position: static !important;
        max-height: none !important;
        overflow-y: visible !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    .tabs-sidebar {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 0.5rem;
        gap: 0.5rem;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        width: 100%;
        max-width: 100%;
    }
    
    .tabs-sidebar::-webkit-scrollbar {
        height: 4px;
    }
    
    .tabs-sidebar::-webkit-scrollbar-track {
        background: var(--bg-secondary);
    }
    
    .tabs-sidebar::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 2px;
    }
    
    .tab-btn {
        flex: 0 0 auto;
        white-space: nowrap;
        min-width: 120px;
    }
    
    .image-preview-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .image-preview-container.original-collapsed {
        grid-template-columns: 1fr;
    }
    
    .image-preview.collapsed {
        display: none;
    }
    
    .image-preview img {
        max-height: 250px;
    }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  opacity: 1;
  animation: modalFadeIn 0.2s ease-out;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  backdrop-filter: blur(2px);
}

.modal-container {
  position: relative;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  min-width: 400px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  margin: auto;
  z-index: 10000;
  transform: scale(1);
  animation: modalSlideIn 0.2s ease-out;
}

/* Modal animations */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.25rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

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

.modal-content {
  padding: 1.5rem;
}

/* Sub-tabs */
.sub-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--bg-secondary);
  padding: 0.25rem;
  border-radius: 6px;
}

.sub-tab-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.sub-tab-btn:hover {
  background: var(--bg-primary);
}

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

.sub-tab-content {
  display: none;
}

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

/* Operations Section Styles */
.operations-section {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.operations-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.operations-header h2 {
  margin: 0;
  color: var(--text-primary);
}

.operations-content.collapsed {
  display: none;
}

/* Mobile Layout - 768px and below */
@media (max-width: 768px) {
    /* Container adjustments */
    body div.container:has(main.tool-container) {
        padding: 0 1rem;
    }
    
    /* Grid layouts to single column */
    .operation-controls {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Two-column metadata display to single column */
    #metadata-tab div[style*="grid-template-columns: 1fr 1fr"] {
        display: block !important;
    }
    
    #metadata-tab div[style*="grid-template-columns: 1fr 1fr"] > div {
        margin-bottom: 1.5rem;
    }
    
    #metadata-tab div[style*="grid-template-columns: 1fr 1fr"] > div:last-child {
        margin-bottom: 0;
    }
    
    /* Hero section format info to single column */
    .hero div[style*="grid-template-columns: 1fr 1fr"] {
        display: block !important;
        text-align: center;
    }
    
    .hero div[style*="grid-template-columns: 1fr 1fr"] > div {
        margin-bottom: 1rem;
    }
    
    .hero div[style*="grid-template-columns: 1fr 1fr"] > div:last-child {
        margin-bottom: 0;
    }
    
    /* Upload area padding */
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .initial-upload-section {
        padding: 2rem 1rem;
        margin: 1rem 0;
    }
    
    /* Modal responsiveness */
    .modal {
        padding: 0.5rem;
        align-items: center;
        justify-content: center;
    }
    
    .modal-container {
        min-width: 95vw;
        max-width: 95vw;
        margin: 0;
        max-height: 90vh;
        width: auto;
    }
    
    .modal-header,
    .modal-content {
        padding: 1rem;
    }
    
    .modal-overlay {
        backdrop-filter: blur(3px);
        background: rgba(0, 0, 0, 0.75);
    }
    
    /* Modal close button touch target */
    .modal-close {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
    
    /* Upload area mobile improvements */
    .upload-area {
        cursor: pointer;
        position: relative;
        border: 3px dashed var(--border-color);
        transition: all 0.3s ease;
    }
    
    .upload-area:active {
        border-color: var(--primary-color);
        background: var(--bg-primary);
        transform: scale(0.98);
    }
    
    /* Better drag and drop visual feedback */
    .upload-area.dragover {
        border-color: var(--primary-color);
        background: var(--primary-color);
        color: white;
        transform: scale(1.02);
    }
    
    /* Image preview adjustments */
    .image-preview img {
        max-height: 200px;
        width: 100%;
        object-fit: contain;
        cursor: pointer;
        transition: transform 0.2s ease;
        border-radius: 6px;
    }
    
    /* Touch-friendly image interactions */
    .image-preview img:active {
        transform: scale(0.95);
    }
    
    /* Image container improvements */
    .image-preview {
        position: relative;
        overflow: hidden;
    }
    
    /* Better image loading states */
    .image-preview .loading {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 200px;
        color: var(--text-secondary);
        font-style: italic;
    }
    
    /* Zoom hint for mobile */
    .image-preview::after {
        content: 'Tap to view full size';
        position: absolute;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        font-size: 0.75rem;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }
    
    .image-preview:hover::after {
        opacity: 1;
    }
    
    /* Button improvements */
    .tab-btn {
        padding: 0.75rem;
        min-width: 100px;
        text-align: center;
    }
    
    /* Touch-friendly controls */
    .btn-enhanced,
    .btn-apply,
    .btn-upload {
        padding: 0.75rem 1.5rem;
        min-height: 44px;
        font-size: 1rem;
    }
    
    /* Form control improvements */
    input[type="range"] {
        height: 44px;
        -webkit-appearance: none;
        background: var(--bg-secondary);
        border-radius: 22px;
        outline: none;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        height: 24px;
        width: 24px;
        border-radius: 50%;
        background: var(--primary-color);
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    
    input[type="range"]::-moz-range-thumb {
        height: 24px;
        width: 24px;
        border-radius: 50%;
        background: var(--primary-color);
        cursor: pointer;
        border: none;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    
    input[type="number"],
    input[type="color"],
    select {
        min-height: 44px;
        padding: 0.5rem;
        font-size: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        background: var(--bg-primary);
    }
    
    /* Checkbox and radio improvements */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        margin-right: 0.5rem;
    }
    
    /* Label improvements for touch */
    .control-group label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
        color: var(--text-primary);
        font-size: 0.95rem;
    }
    
    /* Range slider container improvements */
    .control-group div[style*="display: flex"] {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }
    
    .control-group div[style*="display: flex"] input[type="range"] {
        order: 1;
    }
    
    .control-group div[style*="display: flex"] input[type="number"] {
        order: 2;
        width: 100% !important;
    }
    
    .control-group div[style*="display: flex"] span {
        order: 3;
        text-align: left;
        font-weight: 500;
    }
    
    /* Applied operations section */
    .operation-controls-inline {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .operation-tags-container {
        justify-content: flex-start;
    }
}

/* Small Mobile Layout - 480px and below */
@media (max-width: 480px) {
    /* Further reduce padding */
    body div.container:has(main.tool-container) {
        padding: 0 0.5rem;
    }
    
    .instructions-section,
    .operations-section,
    .file-picker-section,
    .metadata-section {
        padding: 1rem;
    }
    
    /* Stack applied operations controls */
    .applied-operations-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .operation-controls-inline {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Image toggle controls */
    .image-toggle-controls {
        text-align: center;
        margin-bottom: 0.75rem;
    }
    
    /* Tab scrolling improvements */
    .tabs-sidebar {
        gap: 0.25rem;
        padding-bottom: 0.75rem;
        padding-right: 1rem; /* Add padding to ensure last tab is visible */
        scroll-behavior: smooth;
        scrollbar-width: thin;
    }
    
    /* Ensure sidebar container doesn't overflow */
    .sidebar-container {
        overflow: visible !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .tab-btn {
        min-width: 90px;
        font-size: 0.85rem;
        padding: 0.5rem;
    }
    
    /* Sub-tabs responsive */
    .sub-tabs {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .sub-tab-btn {
        flex: none;
    }
    
    /* Range slider improvements */
    .control-group label {
        margin-bottom: 0.5rem;
        display: block;
        font-weight: 500;
    }
    
    /* Prevent zoom on double tap for iOS */
    * {
        touch-action: manipulation;
    }
    
    /* Better spacing for small screens */
    .hero h1 {
        font-size: 1.75rem;
        margin: 1rem 0;
    }
    
    .hero p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Improved metadata display */
    .metadata-display {
        font-size: 0.85rem;
        max-height: 150px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better button spacing */
    .control-group {
        margin-bottom: 1rem;
    }
    
    .control-group:last-child {
        margin-bottom: 0;
    }
}

/* Utility classes for mobile optimization */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-center {
        text-align: center !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    /* Enhanced scrollbar styling for mobile */
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    
    ::-webkit-scrollbar-track {
        background: var(--bg-secondary);
        border-radius: 4px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 4px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: var(--primary-color);
    }
}

/* Focus states for better accessibility on mobile */
@media (max-width: 768px) {
    button:focus,
    input:focus,
    select:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
    
    .tab-btn:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: -2px;
    }
}