/* ============================================================
   Image Metadata Scrubber - Application CSS  v2
   Multi-file, mobile-first, Paranoia Works style
   ============================================================ */

:root {
    --pw-teal: #098572;
    --pw-teal-dark: #06634f;
    --pw-teal-light: #0aa88e;
    --pw-red: #cc3333;
    --pw-orange: #FFAA00;
    --pw-gray-dark: #454545;
    --pw-gray-mid: #888888;
    --pw-gray-light: #AAAAAA;
    --pw-gray-bg: #f4f4f4;
    --pw-border: #969696;
    --pw-white: #ffffff;
    --radius-sm: 3px;
    --radius-md: 6px;
    --shadow-subtle: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-drop: 0 2px 8px rgba(0,0,0,0.12);
    --transition-fast: 0.15s ease;
    --transition-med: 0.25s ease;
}

/* ---- Layout ---- */
#appContainer {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 0.3em;
}

/* ---- Privacy Banner ---- */
.privacy-banner {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: linear-gradient(135deg, #e8f5f0 0%, #f0faf6 100%);
    border: 1px solid #b2dfcf;
    border-radius: var(--radius-md);
    padding: 0.55em 0.7em;
    margin-bottom: 0.8em;
    font-size: 85%;
    color: var(--pw-teal-dark);
    line-height: 1.35;
}

.privacy-banner .shield-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
}

/* ---- Drop Zone ---- */
.drop-zone {
    position: relative;
    border: 2px dashed var(--pw-gray-light);
    border-radius: var(--radius-md);
    padding: 2.2em 1em;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
    background: var(--pw-white);
    -webkit-tap-highlight-color: transparent;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
}

.drop-zone:hover,
.drop-zone:focus-within {
    border-color: var(--pw-teal);
    background: #f8fdfb;
    box-shadow: var(--shadow-subtle);
}

.drop-zone.drag-over {
    border-color: var(--pw-teal-light);
    background: #eaf7f3;
    border-style: solid;
    box-shadow: inset 0 0 0 2px rgba(9,133,114,0.12), var(--shadow-drop);
}

.drop-zone.has-files {
    display: none;
}

.drop-zone .dz-icon {
    width: 48px;
    height: 48px;
    opacity: 0.55;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: none;
}

.drop-zone:hover .dz-icon,
.drop-zone.drag-over .dz-icon {
    opacity: 0.8;
    transform: translateY(-2px);
}

.drop-zone .dz-label {
    font-size: 100%;
    font-weight: bold;
    color: var(--pw-gray-dark);
    pointer-events: none;
}

.drop-zone .dz-sublabel {
    font-size: 82%;
    color: var(--pw-gray-mid);
    pointer-events: none;
}

.drop-zone .dz-sublabel em {
    color: var(--pw-teal);
    font-style: normal;
    font-weight: bold;
}

/* Hidden file input - triggered programmatically only */
#fileInput {
    display: none;
}

/* ============================================================
   FILE LIST - Individual Cards
   ============================================================ */
#fileList {
    margin-top: 0em;
}

.file-card {
    display: flex;
    align-items: stretch;
    background: var(--pw-gray-bg);
    border: 1px solid #ddd;
    border-radius: var(--radius-md);
    margin-bottom: 0.4em;
    overflow: hidden;
    transition: border-color var(--transition-fast);
    animation: cardIn 0.2s ease forwards;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.file-card.scrubbed {
    border-color: var(--pw-teal);
    background: #f6fcfa;
}

.file-card .fc-thumb-wrap {
    flex-shrink: 0;
    width: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-right: 1px solid #eee;
    padding: 4px;
}

.file-card .fc-thumb {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.file-card .fc-body {
    flex: 1;
    min-width: 0;
    padding: 0.4em 0.5em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.12em;
}

.file-card .fc-name {
    font-weight: bold;
    font-size: 90%;
    color: var(--pw-gray-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card .fc-details {
    font-size: 78%;
    color: var(--pw-gray-mid);
}

.file-card .fc-status {
    font-size: 78%;
    font-weight: bold;
}

.fc-status.analyzing  { color: #8d6e00; }
.fc-status.has-meta   { color: #c77700; }
.fc-status.clean-src  { color: var(--pw-teal); }
.fc-status.scrubbed   { color: var(--pw-teal); }
.fc-status.error      { color: var(--pw-red); }

.file-card .fc-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #eee;
}

.file-card .fc-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 0 10px;
    font-size: 17px;
    color: var(--pw-gray-mid);
    transition: background var(--transition-fast), color var(--transition-fast);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    -webkit-tap-highlight-color: transparent;
}

.file-card .fc-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--pw-gray-dark);
}

.file-card .fc-btn.fc-remove:hover {
    background: #fce4ec;
    color: var(--pw-red);
}

.file-card .fc-btn.fc-meta-btn {
    font-size: 13px;
    font-weight: bold;
}

.file-card .fc-btn.fc-meta-btn:hover {
    background: #e8f5f0;
    color: var(--pw-teal);
}

/* ---- Inline badge counts ---- */
.meta-badge {
    display: inline-block;
    font-size: 80%;
    font-weight: bold;
    padding: 0 0.35em;
    border-radius: 3px;
    margin-left: 0.2em;
    vertical-align: middle;
    line-height: 1.5;
    background: #fff3e0;
    color: #e65100;
}

.meta-badge.gps {
    background: #fce4ec;
    color: var(--pw-red);
}

.meta-badge.none {
    background: #e8f5e9;
    color: #2e7d32;
}

/* ============================================================
   BATCH ACTION BAR
   ============================================================ */
.batch-bar {
    display: none;
    margin-top: 0.6em;
    gap: 0.45em;
}

.batch-bar.visible {
    display: flex;
    flex-wrap: wrap;
}

.btn-primary {
    flex: 1;
    min-width: 0;
    border: solid 1px var(--pw-teal);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: bold;
    color: var(--pw-white);
    padding: 10px 16px;
    cursor: pointer;
    background: linear-gradient(to bottom, var(--pw-teal-light) 0%, var(--pw-teal) 50%, var(--pw-teal-dark) 100%);
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.btn-primary:hover { box-shadow: 0 2px 8px rgba(9,133,114,0.3); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.50; cursor: default; transform: none; box-shadow: none; }

.btn-secondary {
    flex: 1;
    min-width: 0;
    border: solid 1px var(--pw-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: bold;
    color: var(--pw-gray-dark);
    padding: 10px 16px;
    cursor: pointer;
    background-color: var(--pw-white);
    background-image: linear-gradient(to bottom, #ffffff 0%, #d7d7d7 49%, #c8c8c8 51%, #f6f6f6 100%);
    transition: border-color var(--transition-fast);
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.btn-secondary:hover { border-color: var(--pw-orange); }
.btn-secondary:active { background-image: linear-gradient(to bottom, #b4b4c8 0%, #7878a0 100%); color: var(--pw-white); }
.btn-secondary:disabled { opacity: 0.45; cursor: default; }

.btn-danger {
    flex: 0 0 auto;
    border: solid 1px #d88;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: bold;
    color: var(--pw-red);
    padding: 10px 14px;
    cursor: pointer;
    background: var(--pw-white);
    transition: background var(--transition-fast), border-color var(--transition-fast);
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.btn-danger:hover { background: #fce4ec; border-color: var(--pw-red); }

/* ============================================================
   STATUS BAR
   ============================================================ */
.status-bar {
    display: none;
    margin-top: 0.55em;
    padding: 0.5em 0.7em;
    border-radius: var(--radius-sm);
    font-size: 87%;
    text-align: center;
    line-height: 1.4;
}

.status-bar.visible { display: block; }
.status-bar.processing { background: #fff8e1; border: 1px solid #ffe082; color: #8d6e00; }
.status-bar.success { background: #e8f5e9; border: 1px solid #a5d6a7; color: #2e7d32; }
.status-bar.error { background: #fce4ec; border: 1px solid #ef9a9a; color: #c62828; }

/* ============================================================
   METADATA VIEWER MODAL (slide-up panel)
   ============================================================ */
.meta-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.45);
    animation: fadeOverlayIn 0.2s ease;
}

.meta-overlay.visible {
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

@keyframes fadeOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.meta-panel {
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    background: var(--pw-white);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from { transform: translateY(30%); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

.meta-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7em 0.9em;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.meta-panel-header .mp-title {
    font-weight: bold;
    font-size: 95%;
    color: var(--pw-gray-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.meta-panel-header .mp-close {
    border: none;
    background: none;
    font-size: 22px;
    color: var(--pw-gray-mid);
    cursor: pointer;
    padding: 0 0 0 12px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.meta-panel-header .mp-close:hover { color: var(--pw-gray-dark); }

.meta-panel-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- Sections inside panel ---- */
.adv-section { border-bottom: 1px solid #eee; }
.adv-section:last-child { border-bottom: none; }

.adv-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5em 0.8em;
    cursor: pointer;
    background: #f5f5f5;
    font-size: 87%;
    font-weight: bold;
    color: var(--pw-gray-dark);
    -webkit-tap-highlight-color: transparent;
    transition: background var(--transition-fast);
    user-select: none;
}

.adv-section-header:hover { background: #eaeaea; }

.adv-section-header .toggle-tri {
    font-size: 70%;
    margin-right: 0.4em;
    display: inline-block;
    transition: transform var(--transition-med);
}

.adv-section-header.expanded .toggle-tri { transform: rotate(90deg); }

.adv-section-header .badge {
    display: inline-block;
    background: var(--pw-teal);
    color: var(--pw-white);
    font-size: 78%;
    padding: 0.1em 0.5em;
    border-radius: 10px;
    min-width: 1.2em;
    text-align: center;
}

.adv-section-body { display: none; padding: 0; }
.adv-section-body.expanded { display: block; }

.meta-table { width: 100%; border-collapse: collapse; font-size: 82%; }
.meta-table tr { border-bottom: 1px solid #f0f0f0; }
.meta-table tr:last-child { border-bottom: none; }
.meta-table td { padding: 0.35em 0.8em; vertical-align: top; }
.meta-table .meta-key {
    font-weight: bold; color: var(--pw-gray-dark); white-space: nowrap;
    width: 42%; max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.meta-table .meta-val { color: #555; word-break: break-all; }
.meta-table .meta-val.gps-highlight { color: var(--pw-red); font-weight: bold; }

.meta-empty {
    padding: 1.5em 0.8em; font-size: 87%; color: var(--pw-gray-mid);
    text-align: center; font-style: italic;
}

.meta-panel-footer {
    flex-shrink: 0; padding: 0.5em 0.8em; border-top: 1px solid #eee;
    text-align: center; font-size: 80%; color: var(--pw-gray-mid);
}

/* ---- Format Note ---- */
.scrub-options {
    margin-top: 0.5em; text-align: center; font-size: 82%;
}
.opt-label {
    cursor: pointer; color: var(--pw-gray-dark); user-select: none;
}
.opt-label input[type="checkbox"] {
    vertical-align: -1px; margin-right: 0.25em; accent-color: var(--pw-teal);
}
.opt-hint {
    color: var(--pw-gray-mid); font-size: 90%;
}

.format-note {
    font-size: 74%; color: var(--pw-gray-mid);
    text-align: center; margin-top: 0.6em; line-height: 1.4;
}

/* ---- Spinner ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.6s linear infinite;
    vertical-align: middle; margin-right: 0.35em;
}

/* ---- Add-more compact zone ---- */
.add-more-zone {
    display: none;
    border: 1.5px dashed var(--pw-gray-light);
    border-radius: var(--radius-md);
    padding: 0.55em 0.8em;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    background: var(--pw-white);
    font-size: 88%;
    color: var(--pw-gray-mid);
    margin-top: 0.4em;
    -webkit-tap-highlight-color: transparent;
}

.add-more-zone.visible { display: block; }
.add-more-zone:hover { border-color: var(--pw-teal); color: var(--pw-teal); background: #f8fdfb; }
.add-more-zone.drag-over { border-color: var(--pw-teal-light); background: #eaf7f3; border-style: solid; }
.add-more-zone b { color: var(--pw-teal); }

/* ---- Privacy Footer ---- */
.privacy-check {
    display: inline-flex; align-items: center; gap: 0.25em;
    font-size: 78%; color: var(--pw-teal); font-weight: bold;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 480px) {
    .drop-zone { padding: 1.8em 0.8em; min-height: 110px; }
    .file-card .fc-thumb-wrap { width: 54px; }
    .file-card .fc-thumb { width: 46px; height: 46px; }
    .btn-primary, .btn-secondary, .btn-danger { padding: 11px 12px; font-size: 14px; }
    .meta-table .meta-key { max-width: 110px; font-size: 80%; }
    .meta-panel { max-height: 85vh; }
}

@media (max-width: 360px) {
    .file-card .fc-thumb-wrap { width: 48px; }
    .file-card .fc-thumb { width: 40px; height: 40px; }
    .file-card .fc-body { padding: 0.3em 0.35em; }
}
