/* ==========================================================================
   MODERN DARK THEME & ANIMATIONS
   ========================================================================== */
:root {
    --bg-dark: #05050a;
    --bg-deep: #0a0a16;
    --card-bg: rgba(20, 25, 40, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);

    /* Brand Colors */
    --primary: #3b82f6;
    --primary-glow: #2563eb;
    --secondary: #8b5cf6;
    --accent: #06b6d4;

    /* Neon Accents */
    --neon-blue: #00f3ff;
    --neon-purple: #bc13fe;
    --neon-pink: #f472b6;

    /* Text */
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    /* Status */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;

    /* Effects */
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --glass-backdrop: blur(16px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.1), transparent 35%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.1), transparent 35%),
        radial-gradient(circle at 50% 80%, rgba(6, 182, 212, 0.05), transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    padding: 40px 20px;
    line-height: 1.5;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    animation: fadeIn 1s ease-out;
}

/* Header & Typography */
.header-section {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
}

h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    background: linear-gradient(to bottom, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
    display: inline-block;
}

h1::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 400%;
    background: radial-gradient(circle, rgb(59 130 246) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    opacity: 0.08;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.badge-pill {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: none;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Upload Section - The "Hero" Card */
.upload-section {
    position: relative;
    background: transparent;
    border-radius: 24px;
    margin-bottom: 40px;
    padding: 1px;
}

.upload-section::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    background: var(--card-border);
    z-index: 0;
    transition: background 0.3s ease;
}

.upload-section:hover::before {
    background: var(--primary);
}

.upload-content-wrapper {
    background: var(--bg-deep);
    border-radius: 23px;
    padding: 40px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.upload-area {
    border: 2px dashed var(--card-border);
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.01);
    position: relative;
    z-index: 10;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.upload-area.drag-over {
    border-color: var(--neon-blue);
    background: rgba(0, 243, 255, 0.1);
    transform: scale(0.99);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: inline-block;
    color: var(--primary);
}

.upload-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.upload-subtext {
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Controls & Buttons */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 30px;
    align-items: center;
    justify-content: center;
}

.btn {
    appearance: none;
    border: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

/* Modern Button Styles */
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: none;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-glow);
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* Form Elements */
.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    height: 44px;
}

/* PDF.js Library Status */
.lib-status {
    margin-top: 20px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 10px;
}

.lib-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
}

.lib-status.loaded .dot {
    background: var(--success);
}

.lib-status.loading .dot {
    background: var(--warning);
    animation: pulse 1s ease-in-out infinite;
}

.lib-status.error .dot {
    background: var(--error);
}

.lib-status .status-text {
    flex: 1;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.controls .btn {
    height: 44px;
}

select {
    background: var(--bg-dark);
    border: 1px solid var(--card-border);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    outline: none;
    font-size: 0.9rem;
}

/* Stats & Summary Cards (Glassmorphism) */
.summary-section {
    margin-bottom: 40px;
    display: none;
}

.summary-section.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: var(--glass-backdrop);
    padding: 24px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.summary-card:hover {
    background: var(--glass-highlight);
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: none;
}

.summary-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent 70%);
    opacity: 0.5;
}

.summary-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.summary-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #e2e8f0);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Custom Colors for Stats */
.summary-card.green .summary-value {
    background: linear-gradient(to right, #34d399, #10b981);
    -webkit-background-clip: text;
}

.summary-card.blue .summary-value {
    background: linear-gradient(to right, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
}

.summary-card.purple .summary-value {
    background: linear-gradient(to right, #c084fc, #a855f7);
    -webkit-background-clip: text;
}

.summary-card.orange .summary-value {
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
}

/* Progress Bar */
.progress-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: var(--glass-backdrop);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 30px;
    display: none;
}

.progress-section.show {
    display: block;
    animation: fadeIn 0.4s ease;
}

.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    box-shadow: none;
    transition: width 0.3s ease;
    border-radius: 100px;
    position: relative;
}

/* Results Grid */
.results-section {
    display: none;
}

.results-section.show {
    display: block;
    animation: slideUp 0.6s ease;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 16px;
}

.results-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
}

.results-grid {
    position: relative;
    min-height: 200px;
}

.virtual-grid-container {
    position: relative;
    width: 100%;
}

.virtual-grid-content {
    position: relative;
    width: 100%;
}

.virtual-card-wrapper {
    position: absolute;
    box-sizing: border-box;
    height: 368px;
    padding-right: 0;
    transition: none; /* Disable transitions for performance */
}

/* File Card Design */
.file-card {
    background: rgba(15, 20, 35, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    min-height: 368px;
}

.file-card:hover {
    border-color: var(--primary);
    box-shadow: none;
}

.card-header {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.card-status {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 100px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.card-status.processing {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.card-status.completed {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.card-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.card-body {
    padding: 20px;
}

.card-metric {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.card-metric:last-child {
    border-bottom: none;
}

.metric-label {
    color: var(--text-dim);
}

.metric-value {
    color: #fff;
    font-weight: 500;
}

/* JSON Modal - Dark Mode */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s;
}

.modal-container {
    background: #0d1117;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #161b22;
    border-radius: 16px 16px 0 0;
}

.json-container {
    padding: 20px;
    background: #0d1117;
    color: #e6edf3;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    overflow: auto;
}

/* JSON Syntax Highlighting */
.json-key {
    color: #7ee787;
}

.json-string {
    color: #a5d6ff;
}

.json-number {
    color: #d2a8ff;
}

.json-boolean {
    color: #ff7b72;
}

.json-null {
    color: #ff7b72;
}

/* Dimensions section in card - Tooltip style */
.dimensions-section {
    position: relative;
    margin-top: 10px;
}

.dimensions-toggle {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.dimensions-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    color: var(--text-main);
}

.dimensions-toggle .arrow {
    transition: transform 0.2s ease;
}

.dimensions-section:hover .dimensions-toggle .arrow {
    transform: rotate(180deg);
}

.dimension-item {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--card-border);
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.dimension-item strong {
    color: var(--primary);
}

.dimension-item code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

.dimensions-content {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    background: rgba(15, 20, 35, 0.98);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    
    /* Minimalist dark scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.dimensions-content::-webkit-scrollbar {
    width: 6px;
}

.dimensions-content::-webkit-scrollbar-track {
    background: transparent;
}

.dimensions-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.dimensions-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.dimensions-section:hover .dimensions-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

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

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    }

    100% {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.2);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

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

/* Toast */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 3000;
}

.toast {
    background: rgba(20, 25, 40, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

/* ==========================================================================
   RESPONSIVE DESIGN - Mobile First Approach
   ========================================================================== */

/* Extra Small Devices (phones, <480px) */
@media (max-width: 479px) {
    body {
        padding: 16px 12px;
    }

    .container {
        width: 100%;
    }

    /* Header */
    .header-section {
        margin-bottom: 32px;
    }

    h1 {
        font-size: 2rem;
        letter-spacing: -0.01em;
    }

    .subtitle {
        font-size: 0.9rem;
        padding: 0 8px;
    }

    .badge-pill {
        font-size: 0.65rem;
        padding: 4px 12px;
        margin-bottom: 16px;
    }

    /* Upload Section */
    .upload-section {
        border-radius: 16px;
        margin-bottom: 24px;
    }

    .upload-section::before {
        border-radius: 16px;
    }

    .upload-content-wrapper {
        border-radius: 15px;
        padding: 20px 16px;
    }

    .upload-area {
        padding: 40px 16px;
        border-radius: 12px;
    }

    .upload-icon {
        font-size: 36px;
        margin-bottom: 12px;
    }

    .upload-icon svg {
        width: 36px;
        height: 36px;
    }

    .upload-text {
        font-size: 1.1rem;
    }

    .upload-subtext {
        font-size: 0.8rem;
    }

    /* Controls */
    .controls {
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
    }

    .control-group {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
    }

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

    /* Progress Section */
    .progress-section {
        padding: 16px;
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .progress-section > div:first-child {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start !important;
    }

    #elapsedTime {
        font-size: 0.8rem !important;
    }

    #progressStats {
        font-size: 0.85rem;
    }

    /* Summary Section */
    .summary-section h2 {
        font-size: 1.1rem;
        margin-bottom: 16px !important;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .summary-card {
        padding: 16px;
        border-radius: 12px;
    }

    .summary-label {
        font-size: 0.65rem;
        margin-bottom: 8px;
    }

    .summary-value {
        font-size: 1.5rem;
    }

    /* Results Section */
    .results-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        padding-bottom: 12px;
        margin-bottom: 16px;
    }

    .results-title {
        font-size: 1.2rem;
        text-align: center;
    }

    #viewAllJsonBtn {
        width: 100%;
        justify-content: center;
    }

    /* Virtual Grid */
    .virtual-card-wrapper {
        height: 320px !important;
    }

    .file-card {
        min-height: 320px;
        max-height: 320px;
        overflow: hidden;
    }

    .card-header {
        padding: 12px 16px;
    }

    .card-title {
        font-size: 0.85rem;
        max-width: 60%;
    }

    .card-status {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    .card-body {
        padding: 16px;
    }

    .card-metric {
        font-size: 0.85rem;
        padding: 6px 0;
    }

    /* Modal */
    .modal-overlay {
        padding: 12px;
    }

    .modal-container {
        border-radius: 12px;
        max-height: 90vh;
    }

    .modal-header {
        padding: 12px 16px;
        border-radius: 12px 12px 0 0;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-header:last-child {
        border-radius: 0 0 12px 12px;
    }

    #modalFileName {
        font-size: 0.85rem;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .json-container {
        font-size: 11px;
        padding: 12px;
    }

    #copyJsonBtn,
    #closeModalBtn {
        padding: 6px 10px !important;
    }

    /* Toast */
    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    .toast {
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    /* Dimensions */
    .dimensions-section {
        margin-top: 8px;
    }

    .dimensions-toggle {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    .dimensions-content {
        max-height: 150px;
    }

    .dimension-item {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

/* Small Devices (large phones, 480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
    body {
        padding: 24px 16px;
    }

    h1 {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .badge-pill {
        font-size: 0.7rem;
    }

    /* Upload */
    .upload-content-wrapper {
        padding: 28px 20px;
    }

    .upload-area {
        padding: 48px 20px;
    }

    .upload-text {
        font-size: 1.25rem;
    }

    /* Controls */
    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .control-group {
        flex: 1 1 auto;
        min-width: 140px;
        justify-content: center;
    }

    /* Summary */
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .summary-card {
        padding: 20px;
    }

    .summary-value {
        font-size: 1.75rem;
    }

    /* Results */
    .results-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    #viewAllJsonBtn {
        width: 100%;
        justify-content: center;
    }

    /* Cards */
    .file-card {
        min-height: 360px;
        max-height: 360px;
        overflow: hidden;
    }

    .virtual-card-wrapper {
        height: 360px !important;
    }

    /* Modal */
    .modal-container {
        max-height: 85vh;
    }

    .json-container {
        font-size: 12px;
    }
}

/* Medium Devices (tablets, 768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    body {
        padding: 32px 24px;
    }

    h1 {
        font-size: 3rem;
    }

    .header-section {
        margin-bottom: 48px;
    }

    /* Upload */
    .upload-content-wrapper {
        padding: 32px;
    }

    .upload-area {
        padding: 52px 24px;
    }

    /* Controls */
    .controls {
        gap: 12px;
    }

    .control-group {
        padding: 8px 14px;
    }

    /* Summary */
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .summary-card {
        padding: 20px;
    }

    .summary-value {
        font-size: 2rem;
    }

    /* Results */
    .results-header {
        flex-direction: row;
    }

    #viewAllJsonBtn {
        width: auto;
    }

    /* Cards - 2 columns on tablets */
    .file-card {
        min-height: 350px;
        max-height: 350px;
        overflow: hidden;
    }

    .virtual-card-wrapper {
        height: 350px !important;
    }
}

/* Large Devices (desktops, 1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    body {
        padding: 36px 32px;
    }

    h1 {
        font-size: 3.5rem;
    }

    .summary-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .summary-card {
        padding: 22px;
    }

    .summary-value {
        font-size: 2rem;
    }
}

/* Extra Large Devices (large desktops, 1280px+) */
@media (min-width: 1280px) {
    .container {
        max-width: 1400px;
    }

    h1 {
        font-size: 4rem;
    }

    .summary-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .summary-value {
        font-size: 2.25rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 48px;
        padding: 14px 24px;
    }

    .control-group {
        min-height: 48px;
    }

    select {
        min-height: 36px;
        padding: 6px 12px;
    }

    /* Dimensions - tap instead of hover */
    .dimensions-section {
        position: relative;
    }

    .dimensions-content {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.95);
        width: calc(100% - 40px);
        max-width: 400px;
        max-height: 60vh;
        margin-bottom: 0;
        opacity: 0;
        visibility: hidden;
        z-index: 1500;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    }

    .dimensions-section.active .dimensions-content {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, -50%) scale(1);
    }

    .dimensions-section:hover .dimensions-content {
        opacity: 0;
        visibility: hidden;
        transform: translate(-50%, -50%) scale(0.95);
    }

    .dimensions-section.active:hover .dimensions-content {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, -50%) scale(1);
    }

    /* Upload area - larger for touch */
    .upload-area {
        min-height: 200px;
    }

    /* File cards - better touch feedback */
    .file-card {
        transition: transform 0.15s ease, border-color 0.15s ease;
    }

    .file-card:active {
        transform: scale(0.98);
    }

    /* Buttons touch feedback */
    .btn:active {
        transform: scale(0.96);
    }

    .view-json-btn {
        min-height: 44px;
    }
}

/* Landscape Mode for Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 16px;
    }

    .header-section {
        margin-bottom: 24px;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        display: none;
    }

    .upload-area {
        padding: 24px 16px;
    }

    .upload-icon {
        display: none;
    }

    .modal-container {
        max-height: 95vh;
    }

    .summary-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .summary-card {
        padding: 12px;
    }

    .summary-value {
        font-size: 1.25rem;
    }

    .summary-label {
        font-size: 0.6rem;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .file-card,
    .summary-card,
    .modal-container {
        border-width: 0.5px;
    }
}

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

    .upload-area:hover {
        transform: none;
    }

    .file-card:hover {
        transform: none;
    }

    .summary-card:hover {
        transform: none;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
        padding: 20px;
    }

    .upload-section,
    .progress-section,
    .modal-overlay,
    .toast-container,
    .btn {
        display: none !important;
    }

    .summary-section,
    .results-section {
        display: block !important;
    }

    .summary-card,
    .file-card {
        background: white;
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    .summary-value,
    .card-title {
        color: black !important;
        background: none !important;
        -webkit-background-clip: unset !important;
    }
}

