/* --- DESIGN SYSTEM VARS --- */
:root {
    --bg-body: #000000;
    --bg-card: #0a0a0a;
    --bg-hover: #161616;
    --border-subtle: #262626;
    --border-active: #404040;
    --primary: #ededed;
    --primary-inverse: #000000;
    --text-main: #ededed;
    --text-muted: #737373;
    --accent: #3b82f6;
    --danger: #ef4444;
    --radius: 6px;
}

/* --- RESET & TYPOGRAPHY --- */
* { box-sizing: border-box; outline: none; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

/* --- LAYOUT CONTAINER --- */
.app-container { width: 100%; max-width: 720px; animation: fadeIn 0.5s ease-out; }

/* --- HEADER SECTION --- */
.app-header { text-align: center; margin-bottom: 40px; }

.status-badge {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px;
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-subtle);
    border-radius: 100px; font-size: 0.75rem; font-weight: 500;
    color: var(--text-muted); margin-bottom: 20px; letter-spacing: 0.5px;
}

.status-dot {
    width: 8px; height: 8px; background-color: #10b981;
    border-radius: 50%; box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    animation: pulse 2s infinite;
}

.header-title {
    font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 10px;
    background: linear-gradient(135deg, #ffffff 0%, #737373 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.header-desc { font-size: 1rem; color: var(--text-muted); max-width: 450px; margin: 0 auto; line-height: 1.6; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --- TABS --- */
.tabs { display: flex; background: var(--bg-card); padding: 4px; border: 1px solid var(--border-subtle); border-radius: var(--radius); margin-bottom: 24px; }
.tab-btn {
    flex: 1; background: transparent; border: none; color: var(--text-muted);
    padding: 10px; font-size: 0.9rem; font-weight: 500; cursor: pointer;
    border-radius: 4px; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { background: var(--bg-hover); color: var(--text-main); box-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* --- CARD & UPLOAD ZONE --- */
.main-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 1.5rem; position: relative; overflow: hidden; }

.upload-zone {
    border: 1px dashed var(--border-active); background: rgba(255,255,255,0.02);
    border-radius: var(--radius); padding: 40px 20px; text-align: center;
    cursor: pointer; transition: all 0.2s ease;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--text-muted); background: var(--bg-hover); }
.upload-icon { font-size: 24px; color: var(--text-muted); margin-bottom: 12px; }
.upload-text { font-size: 0.9rem; color: var(--text-muted); font-weight: 400; }
.upload-text span { color: var(--text-main); text-decoration: underline; text-decoration-color: var(--border-active); }

/* --- PREVIEW GRID --- */
#previewContainer { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; margin-top: 20px; }
.preview-thumb { width: 100%; height: 80px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border-subtle); opacity: 0.7; }

/* --- BUTTONS --- */
.btn-primary {
    width: 100%; margin-top: 20px; background: var(--primary); color: var(--primary-inverse);
    border: none; padding: 14px; border-radius: var(--radius); font-size: 0.95rem; font-weight: 600;
    cursor: pointer; transition: transform 0.1s, opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: var(--border-subtle); color: var(--text-muted); cursor: not-allowed; }

/* --- RESULT LIST --- */
.result-list { margin-top: 24px; border-top: 1px solid var(--border-subtle); padding-top: 20px; }
.result-item {
    display: flex; justify-content: space-between; align-items: center; background: var(--bg-body);
    padding: 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius);
    margin-bottom: 8px; font-size: 0.85rem; font-family: 'Monaco', 'Consolas', monospace;
}
.result-actions { display: flex; gap: 10px; }
.action-link { color: var(--text-main); text-decoration: none; cursor: pointer; transition: 0.2s; }
.action-link:hover { color: var(--accent); }

/* --- HISTORY GRID --- */
.section-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin: 40px 0 16px 0; font-weight: 600; }

.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.asset-card {
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius);
    overflow: hidden; transition: all 0.2s ease; position: relative;
}
.asset-card:hover { border-color: var(--border-active); transform: translateY(-2px); }

.asset-img-wrapper { height: 140px; width: 100%; background: #111; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.asset-img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; opacity: 0.8; }
.asset-card:hover .asset-img { opacity: 1; }

.asset-meta { padding: 12px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border-subtle); }
.asset-size { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; }
.asset-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; transition: 0.2s; }
.asset-btn:hover { color: var(--text-main); }
.asset-btn.delete:hover { color: var(--danger); }

/* --- TOAST --- */
#toastBox { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--primary); color: var(--primary-inverse); padding: 12px 24px;
    border-radius: var(--radius); font-size: 0.9rem; font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5); animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- LOGIN OVERLAY --- */
#loginOverlay { position: fixed; inset: 0; background: var(--bg-body); z-index: 2000; display: flex; justify-content: center; align-items: center; }
.login-box { width: 300px; text-align: center; }
.login-input {
    background: var(--bg-card); border: 1px solid var(--border-subtle); color: var(--text-main);
    padding: 12px; width: 100%; margin-bottom: 12px; border-radius: var(--radius);
    text-align: center; letter-spacing: 3px;
}
.login-input:focus { border-color: var(--text-muted); }

/* --- APP SWITCHER BUTTON --- */
.nav-switcher {
    position: absolute; top: 20px; right: 20px; text-decoration: none;
    background: rgba(255, 255, 255, 0.1); border: 1px solid var(--border-subtle);
    padding: 8px 16px; border-radius: 50px; font-size: 0.8rem; color: var(--text-muted);
    transition: 0.2s; display: flex; align-items: center; gap: 8px;
}
.nav-switcher:hover { background: var(--accent); color: white; border-color: var(--accent); }