/* ====================================================================
   Any Share - Modern White & Emerald Green Clean Theme
   ==================================================================== */

:root {
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --border-focus: #10b981;

    --primary: #10b981;
    --primary-hover: #059669;
    --primary-dark: #047857;
    --primary-light: #34d399;
    --primary-bg: #ecfdf5;
    --primary-glow: rgba(16, 185, 129, 0.2);

    --emerald: #10b981;
    --emerald-dark: #065f46;
    --cyan: #0ea5e9;
    --amber: #f59e0b;
    --rose: #ef4444;

    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #94a3b8;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 20px -2px rgba(16, 185, 129, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 32px -4px rgba(16, 185, 129, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 24px var(--primary-glow);

    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Subtle background accent mesh */
.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
    background: radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.04) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 40%);
}

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

/* Header */
.app-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.9rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
}

.logo-icon-wrap {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.brand-logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(16, 185, 129, 0.25));
    transition: var(--transition);
}

.brand-logo:hover .brand-logo-img {
    transform: scale(1.08);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.accent {
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.header-github-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    background: #ffffff;
    transition: var(--transition);
    text-decoration: none;
}

.header-github-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-bg);
    transform: translateY(-1px);
}

.footer-github-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
    text-decoration: none;
    vertical-align: middle;
}

.footer-github-link:hover {
    color: var(--primary);
    transform: scale(1.15);
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 2rem 0 3.5rem;
}

/* Clean Search Bar Section */
.search-card-wrapper {
    margin-bottom: 2rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.35rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-dim);
    margin-left: 0.85rem;
    margin-right: 0.65rem;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--text-main);
    padding: 0.65rem 0;
}

.search-input::placeholder {
    color: var(--text-dim);
}

.search-btn {
    padding: 0.7rem 1.4rem;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.925rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.search-hints {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.65rem;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.recent-ids {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.recent-chip {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
}

.recent-chip:hover {
    color: var(--primary-dark);
    border-color: var(--primary);
    background: var(--primary-bg);
}

/* Upload Hub Card */
.upload-hub-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

/* Secret ID Input Bar */
.secret-id-bar {
    padding: 1.15rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.secret-id-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-main);
    min-width: 140px;
}

.secret-id-field-wrap {
    flex: 1;
    width: 100%;
}

.input-styled {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.95rem;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.925rem;
    outline: none;
    transition: var(--transition);
}

.input-styled:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Two Modern Segmented Upload Tabs */
.upload-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 5px;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    gap: 4px;
    border: 1px solid var(--border-color);
}

.upload-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.upload-tab svg {
    width: 18px;
    height: 18px;
}

.upload-tab:hover {
    color: var(--text-main);
}

.upload-tab.active {
    background: #ffffff;
    color: var(--emerald-dark);
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Drop Zone */
.dropzone-container {
    padding: 1.75rem 1.5rem;
}

.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    background: #f8fafc;
    padding: 2.75rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
    transform: scale(0.998);
}

.dropzone-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    transition: var(--transition);
}

.dropzone:hover .dropzone-icon {
    transform: translateY(-3px);
    background: #d1fae5;
}

.dropzone-icon svg {
    width: 28px;
    height: 28px;
}

.dropzone-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.dropzone-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* Text Upload Section */
.text-upload-container {
    padding: 1.5rem;
    display: none;
}

.text-meta-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    align-items: center;
}

.text-filename-input {
    flex: 1;
    max-width: 320px;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.85rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-main);
    outline: none;
}

.text-filename-input:focus {
    border-color: var(--primary);
}

.text-editor-area {
    width: 100%;
    height: 220px;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-main);
    outline: none;
    resize: vertical;
    line-height: 1.6;
    transition: var(--transition);
}

.text-editor-area:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.7rem 1.35rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 14px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

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

/* Staged Files List */
.staged-section {
    margin-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
}

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

.staged-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.staged-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.staged-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
}

.staged-file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
}

.staged-file-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.staged-file-size {
    color: var(--text-dim);
    font-size: 0.75rem;
}

.staged-file-remove {
    background: none;
    border: none;
    color: var(--rose);
    cursor: pointer;
    padding: 0.2rem;
    opacity: 0.8;
}

.staged-file-remove:hover {
    opacity: 1;
}

/* Progress Card */
.progress-card {
    margin-top: 1.25rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--emerald) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-full);
    transition: width 0.2s ease;
}

/* Upload Success Panel */
.upload-success-panel {
    margin-top: 1.5rem;
    background: var(--primary-bg);
    border: 1.5px solid #a7f3d0;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.success-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #d1fae5;
    color: var(--emerald-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.65rem;
}

.success-icon-badge svg {
    width: 24px;
    height: 24px;
}

.success-key-box {
    margin: 0.85rem auto;
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #ffffff;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
}

.success-key-text {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-dark);
}

/* ====================================================================
   S3 BROWSER & EXPLORER VIEW (browse.php) - Premium White & Emerald
   ==================================================================== */

.s3-explorer-header {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
    margin-bottom: 1.25rem;
}

.explorer-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.explorer-id-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.bucket-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
    border-radius: var(--radius-full);
    padding: 0.35rem 0.85rem;
    box-shadow: 0 1px 2px rgba(16, 185, 129, 0.08);
}

.bucket-pill-icon {
    color: var(--primary);
    display: flex;
    align-items: center;
}

.bucket-pill-label {
    font-size: 0.78rem;
    color: #15803d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.bucket-pill-id {
    font-family: var(--font-mono);
    color: #065f46;
    font-size: 0.95rem;
    font-weight: 800;
}

.btn-copy-id {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #10b981;
    padding: 3px 5px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-copy-id:hover {
    background: #dcfce7;
    color: #047857;
}

.explorer-stats-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.28rem 0.65rem;
}

.stat-chip svg {
    color: var(--text-dim);
}

/* Countdown Badge */
.countdown-badge-card {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: var(--radius-full);
    padding: 0.35rem 0.9rem;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.08);
}

.countdown-pulse-icon {
    display: flex;
    align-items: center;
    color: #d97706;
    animation: soft-pulse 2s infinite ease-in-out;
}

.countdown-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #92400e;
}

.countdown-timer-text {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 0.95rem;
    color: #b45309;
    min-width: 46px;
    text-align: center;
}

@keyframes soft-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.75; }
}

.explorer-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0.95rem 0;
    width: 100%;
}

.explorer-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
}

/* Breadcrumb Navigation */
.explorer-breadcrumb-trail {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0.2rem 0;
    scrollbar-width: none;
}

.explorer-breadcrumb-trail::-webkit-scrollbar {
    display: none;
}

.crumb-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.825rem;
    padding: 0.3rem 0.55rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.crumb-link:hover {
    color: var(--primary);
    background: #f1f5f9;
}

.crumb-link.crumb-active {
    color: var(--primary-dark);
    font-weight: 700;
}

.crumb-sep {
    color: var(--text-dim);
    font-size: 0.75rem;
}

.crumb-current {
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.825rem;
    padding: 0.3rem 0.55rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* Actions Toolbar */
.explorer-btn-toolbar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.view-mode-pill {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
    height: 38px;
}

.view-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 32px;
    padding: 0 0.65rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.view-mode-btn:hover {
    color: var(--text-main);
}

.view-mode-btn.active {
    background: #ffffff;
    color: var(--primary-dark);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-weight: 700;
}

/* Unified Action Buttons (38px height, uniform padding & typography) */
.btn-action-emerald,
.btn-action-secondary,
.btn-action-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    height: 38px;
    padding: 0 0.95rem;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.825rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1;
}

.btn-action-emerald {
    background: #ecfdf5;
    border: 1.5px solid #a7f3d0;
    color: #047857;
}

.btn-action-emerald:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
    transform: translateY(-1px);
}

.btn-action-secondary {
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    color: #334155;
}

.btn-action-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-main);
    transform: translateY(-1px);
}

.btn-action-primary {
    background: var(--primary);
    border: 1.5px solid var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-action-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
}

/* ====================================================================
   Explorer Table Card
   ==================================================================== */

.explorer-table-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.modern-s3-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.modern-s3-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.725rem;
    letter-spacing: 0.05em;
    padding: 0.85rem 1.25rem;
    border-bottom: 1.5px solid var(--border-color);
}

.modern-s3-table td {
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.modern-s3-table tbody tr:last-child td {
    border-bottom: none;
}

.modern-s3-table tbody tr:hover td {
    background: #fbfcfd;
}

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.file-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.icon-parent {
    background: #f1f5f9;
    color: #64748b;
}

.icon-folder {
    background: #fef3c7;
    border: 1px solid #fde68a;
}

.icon-image {
    background: #e0f2fe;
    border: 1px solid #bae6fd;
}

.icon-video {
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
}

.icon-audio {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.icon-code {
    background: #e0e7ff;
    border: 1px solid #c7d2fe;
}

.icon-pdf {
    background: #fee2e2;
    border: 1px solid #fecaca;
}

.icon-archive {
    background: #ffedd5;
    border: 1px solid #fed7aa;
}

.icon-generic {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.file-name-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.file-main-link {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 480px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.file-main-link:hover {
    color: var(--primary);
}

.mobile-file-meta {
    display: none;
    font-size: 0.735rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.download-count-pill {
    font-size: 0.7rem;
    color: var(--emerald-dark);
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    margin-left: 0.35rem;
}

.file-size-text {
    font-family: var(--font-mono);
    font-size: 0.825rem;
    color: #334155;
    font-weight: 500;
}

.file-type-pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    background: #f1f5f9;
    border-radius: 4px;
    padding: 0.15rem 0.45rem;
    letter-spacing: 0.04em;
}

.file-date-text {
    font-size: 0.785rem;
    color: var(--text-dim);
}

.table-actions-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

.action-btn-circle {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

.action-btn-download:hover {
    background: #ecfdf5;
    border-color: #10b981;
    color: #047857;
}

/* Grid View */
.s3-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    padding: 1.25rem;
}

.grid-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 0.85rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.grid-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.grid-icon {
    font-size: 2.25rem;
    margin-bottom: 0.65rem;
}

.grid-title {
    font-weight: 600;
    font-size: 0.825rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    margin-bottom: 0.25rem;
}

.grid-meta {
    font-size: 0.725rem;
    color: var(--text-dim);
}

/* Empty State */
.s3-empty-state {
    padding: 3.5rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

/* Preview Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.25rem;
}

.modal-backdrop.open {
    display: flex;
}

.modal-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 940px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.modal-header {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    flex-shrink: 0;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    min-width: 0;
}

.modal-file-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.modal-file-name {
    font-size: 1.05rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 450px;
    color: var(--text-main);
}

.modal-file-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    display: block;
    margin-top: 0.1rem;
}

.modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 380px;
    max-height: calc(88vh - 70px);
    background: #ffffff;
    overflow: hidden;
    position: relative;
    padding: 0;
}

.modal-dynamic-container {
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 380px;
}

/* Media Wrappers */
.modal-media-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: auto;
    background: #f8fafc;
}

.modal-preview-img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-sm);
    object-fit: contain;
    box-shadow: var(--shadow-md);
}

.modal-preview-video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    outline: none;
}

.modal-audio-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    background: #f8fafc;
}

.audio-player-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.audio-art {
    font-size: 3rem;
    margin-bottom: 1.25rem;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(16, 185, 129, 0.2);
}

.audio-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.35rem;
    word-break: break-all;
}

.audio-meta {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

.modal-preview-audio {
    width: 100%;
    outline: none;
}

.modal-preview-iframe {
    width: 100%;
    height: 72vh;
    border: none;
    display: block;
}

/* Modern Dark IDE Code & Text Viewer */
.code-viewer-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 380px;
    background: #0b0f19;
    overflow: hidden;
}

.code-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.25rem;
    background: #161e2e;
    border-bottom: 1px solid #283548;
    flex-shrink: 0;
}

.code-viewer-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.code-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
}

.code-stat {
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 500;
}

.code-dot {
    color: #475569;
    font-size: 0.75rem;
}

.btn-code-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-code-copy:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.code-viewer-content {
    display: block;
    flex: 1;
    overflow: auto;
    background: #0b0f19;
    min-height: 340px;
    max-height: 70vh;
    padding: 0.75rem 0;
}

.code-editor-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.65;
}

.code-line-row {
    display: table-row;
    transition: background 0.15s ease;
}

.code-line-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.code-line-num {
    display: table-cell;
    width: 1%;
    min-width: 48px;
    padding: 0.1rem 0.85rem 0.1rem 1rem;
    text-align: right;
    color: #475569;
    user-select: none;
    border-right: 1px solid #1e293b;
    vertical-align: top;
    white-space: nowrap;
}

.code-line-text {
    display: table-cell;
    padding: 0.1rem 1.25rem 0.1rem 1rem;
    color: #f1f5f9;
    white-space: pre;
    vertical-align: top;
}

/* Fallback box */
.preview-fallback-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3.5rem 1.5rem;
    background: #f8fafc;
    flex: 1;
    width: 100%;
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 2000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.15rem;
    color: var(--text-main);
    box-shadow: var(--shadow-md);
    font-size: 0.875rem;
    font-weight: 600;
}

.toast-success {
    border-left: 4px solid var(--emerald);
}

.toast-error {
    border-left: 4px solid var(--rose);
}

/* Footer */
.app-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 0;
    margin-top: auto;
    background: #ffffff;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ====================================================================
   Comprehensive Mobile & Tablet Responsive Rules
   ==================================================================== */

@media (max-width: 860px) {
    .explorer-toolbar-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .explorer-breadcrumb-trail {
        width: 100%;
    }
    .explorer-btn-toolbar {
        width: 100%;
        justify-content: stretch;
    }
    .explorer-btn-toolbar > * {
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media (max-width: 680px) {
    .header-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }
    .brand-title {
        font-size: 1.15rem;
    }
    .expiry-pill-banner {
        font-size: 0.725rem;
        padding: 0.25rem 0.55rem;
    }
    .db-status-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    .s3-explorer-header {
        padding: 1rem 0.85rem;
        border-radius: var(--radius-md);
    }
    .explorer-meta-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .explorer-id-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .bucket-pill {
        width: 100%;
        justify-content: space-between;
        padding: 0.4rem 0.85rem;
    }
    .explorer-stats-wrap {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
    }
    .stat-chip {
        flex: 1 1 auto;
        justify-content: center;
        font-size: 0.735rem;
    }
    .countdown-badge-card {
        width: 100%;
        justify-content: center;
        padding: 0.45rem;
    }
    
    .explorer-btn-toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
        width: 100%;
    }
    .view-mode-pill {
        grid-column: span 2;
        width: 100%;
        justify-content: center;
    }
    .view-mode-btn {
        flex: 1;
        justify-content: center;
    }
    .btn-action-emerald,
    .btn-action-secondary,
    .btn-action-primary {
        width: 100%;
        font-size: 0.785rem;
        padding: 0 0.5rem;
    }
    
    /* Table Responsive Adaptation */
    .col-hide-mobile {
        display: none !important;
    }
    .mobile-file-meta {
        display: block;
    }
    .modern-s3-table th,
    .modern-s3-table td {
        padding: 0.7rem 0.75rem;
    }
    .file-main-link {
        max-width: 170px;
        font-size: 0.825rem;
    }
    .file-icon-box {
        width: 32px;
        height: 32px;
        font-size: 1.05rem;
    }
    .action-btn-circle {
        width: 30px;
        height: 30px;
    }
    
    /* Search & Upload Card Responsive */
    .search-card-wrapper {
        margin-bottom: 1.25rem;
    }
    .search-box {
        padding: 0.3rem 0.35rem;
    }
    .search-icon {
        width: 18px;
        height: 18px;
        margin-left: 0.65rem;
        margin-right: 0.45rem;
    }
    .search-input {
        font-size: 0.875rem;
        padding: 0.55rem 0;
    }
    .search-btn {
        padding: 0.55rem 0.95rem;
        font-size: 0.825rem;
        gap: 0.3rem;
        flex-shrink: 0;
    }
    .search-hints {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
        font-size: 0.75rem;
        margin-top: 0.5rem;
        padding: 0 0.25rem;
    }
    .secret-id-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
        padding: 0.75rem 0.85rem;
    }
    .secret-id-field-wrap {
        width: 100%;
    }
    .upload-tabs {
        width: 100%;
        margin-bottom: 1rem;
    }
    .upload-tab {
        flex: 1;
        font-size: 0.825rem;
        padding: 0.55rem 0.35rem;
        gap: 0.35rem;
    }
    .dropzone {
        padding: 1.75rem 1rem;
    }
    .footer-inner {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .explorer-btn-toolbar {
        grid-template-columns: 1fr;
    }
    .view-mode-pill {
        grid-column: span 1;
    }
    .file-main-link {
        max-width: 125px;
    }
    .s3-grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.65rem;
        padding: 0.75rem;
    }
    .grid-card {
        padding: 0.85rem 0.45rem;
    }
    .grid-icon {
        font-size: 1.8rem;
    }
    .modal-card {
        max-height: 95vh;
        border-radius: var(--radius-md);
    }
}
