/* ============================================================
   GeoStation - Florêncio Engenharia Design System
   ============================================================ */

:root {
    --bg-primary:    #0B0E14;
    --bg-secondary:  #111827;
    --bg-card:       #151a27;
    --bg-card-hover: #1c2236;
    --bg-elevated:   #1a2035;
    --bg-input:      #0f1420;
    --border-subtle: #1e293b;
    --border-default:#293548;
    --border-focus:  #2dd4bf;
    --text-primary:  #f1f5f9;
    --text-secondary:#94a3b8;
    --text-muted:    #64748b;
    --accent:        #2dd4bf;
    --accent-light:  #5eead4;
    --accent-dark:   #14b8a6;
    --accent-glow:   rgba(45, 212, 191, 0.15);
    --glass-bg:      rgba(21, 26, 39, 0.6);
    --glass-border:  rgba(255, 255, 255, 0.06);
    --success:       #22c55e;
    --warn:          #f59e0b;
    --error:         #ef4444;
    --info:          #3b82f6;
    --radius:        16px;
    --radius-sm:     10px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background ambient glow */
body::before {
    content: '';
    position: fixed;
    top: -40%; left: -20%;
    width: 80%; height: 80%;
    background: radial-gradient(ellipse, rgba(45, 212, 191, 0.04) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}
body::after {
    content: '';
    position: fixed;
    bottom: -30%; right: -20%;
    width: 60%; height: 60%;
    background: radial-gradient(ellipse, rgba(45, 212, 191, 0.03) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(45, 212, 191, 0.15); }
    50%      { box-shadow: 0 0 40px rgba(45, 212, 191, 0.25); }
}
@keyframes pulse-border {
    0%, 100% { border-color: var(--accent); }
    50%      { border-color: var(--accent-light); }
}

.animate-fadeInUp { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3b4d66; }

/* ---- Header ---- */
header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(17, 24, 39, 0.82);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 24px; height: 60px;
    display: flex; align-items: center; gap: 14px;
}

.logo-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 24px rgba(45, 212, 191, 0.2);
    flex-shrink: 0;
}
.logo-mark svg { width: 20px; height: 20px; }

header h1 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 1.05rem; font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sub-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem; font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 3px 10px; border-radius: 20px;
    letter-spacing: 0.3px;
}

.header-spacer { flex: 1; }

.header-link {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.72rem; font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 12px; border-radius: 8px;
    transition: all 0.2s;
}
.header-link:hover { color: var(--accent); background: rgba(45, 212, 191, 0.06); }
.header-link svg { width: 14px; height: 14px; }

/* ---- Main ---- */
main {
    position: relative; z-index: 1;
    max-width: 1200px; width: 100%;
    margin: 0 auto;
    padding: 24px 20px 48px;
    display: flex; flex-direction: column; gap: 20px;
}

/* ---- Layout Grid ---- */
.layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    min-height: 480px;
}
@media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; }
}

/* ---- Upload Column ---- */
.upload-col {
    display: flex; flex-direction: column; gap: 12px;
}

/* ---- Dropzone ---- */
.dropzone {
    flex: 1; min-height: 200px;
    border: 2px dashed var(--border-default);
    border-radius: var(--radius);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 14px; padding: 28px 20px;
    text-align: center; cursor: pointer;
    transition: all 0.25s;
    background: var(--bg-card);
}
.dropzone:hover, .dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(45, 212, 191, 0.03);
    box-shadow: 0 0 30px rgba(45, 212, 191, 0.06);
}
.dropzone.drag-over {
    animation: pulse-border 1s ease-in-out infinite;
}

.drop-icon {
    width: 52px; height: 52px; border-radius: 14px;
    background: rgba(45, 212, 191, 0.08);
    border: 1px solid rgba(45, 212, 191, 0.15);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s;
}
.dropzone:hover .drop-icon {
    background: rgba(45, 212, 191, 0.12);
    box-shadow: 0 0 20px rgba(45, 212, 191, 0.15);
}
.drop-icon svg { width: 24px; height: 24px; color: var(--accent); }

.drop-label {
    font-size: 0.82rem; color: var(--text-secondary);
    line-height: 1.7;
}
.drop-label strong { color: var(--accent); font-weight: 600; }

.drop-formats {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem; color: var(--text-muted);
    letter-spacing: 0.4px;
    background: var(--bg-primary);
    padding: 4px 12px; border-radius: 6px;
    border: 1px solid var(--glass-border);
}

/* ---- File Info Card ---- */
.file-info {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: none; flex-direction: column; gap: 10px;
    animation: fadeInUp 0.3s ease forwards;
}
.file-info.visible { display: flex; }

.fname {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem; color: var(--text-primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: flex; align-items: center; gap: 8px;
}
.fname svg { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; }

.meta { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 6px;
    font-size: 0.65rem; font-weight: 600; letter-spacing: 0.3px;
    font-family: 'JetBrains Mono', monospace;
}
.badge-fmt { background: rgba(45, 212, 191, 0.12); color: var(--accent); }
.badge-pts { background: rgba(34, 197, 94, 0.12); color: var(--success); }
.badge-sta { background: rgba(59, 130, 246, 0.12); color: var(--info); }

/* ---- Glass Card ---- */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    display: flex; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-default); }

.card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.015);
    border-radius: var(--radius) var(--radius) 0 0;
}
.card-head h2 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 8px;
}
.card-head h2 svg { width: 16px; height: 16px; color: var(--accent); }

/* ---- Table ---- */
.output-wrap { flex: 1; overflow: auto; max-height: 500px; }
.output-wrap table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }

.output-wrap thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 11px 14px; text-align: left;
    font-size: 0.65rem;
    border-bottom: 1px solid var(--border-default);
}

.output-wrap tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--glass-border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem; white-space: nowrap;
    color: var(--text-secondary);
}
.output-wrap tbody tr { transition: background 0.15s; }
.output-wrap tbody tr:hover {
    background: var(--accent-glow);
}
.output-wrap tbody tr:hover td { color: var(--text-primary); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border: none; border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--bg-primary);
    box-shadow: 0 2px 12px rgba(45, 212, 191, 0.2);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(45, 212, 191, 0.3);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(45, 212, 191, 0.06);
}

.btn-sm { padding: 6px 12px; font-size: 0.72rem; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: none; padding: 8px;
}
.btn-ghost:hover { color: var(--accent); }
.btn-ghost svg { width: 16px; height: 16px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- View Mode Select ---- */
.view-select {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 5px 10px; border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}
.view-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}
.view-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ---- Export Bar ---- */
.export-bar {
    display: none; gap: 8px; flex-wrap: wrap;
    padding: 12px 20px;
    border-top: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.01);
    align-items: center;
    border-radius: 0 0 var(--radius) var(--radius);
}
.export-bar.visible { display: flex; }
.export-bar .label {
    font-size: 0.65rem; color: var(--text-muted);
    font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.6px; margin-right: 4px;
    display: flex; align-items: center; gap: 6px;
}
.export-bar .label svg { width: 14px; height: 14px; color: var(--accent); }

/* ---- Empty State ---- */
.empty-state {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 0.85rem;
    padding: 40px; text-align: center; line-height: 1.7;
    gap: 12px;
}
.empty-state svg { width: 40px; height: 40px; color: var(--border-default); }

/* ---- Raw View ---- */
pre.raw-view {
    display: none; padding: 16px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.73rem; color: var(--text-secondary);
    white-space: pre-wrap; overflow: auto;
    max-height: 460px; line-height: 1.7;
}

/* ---- Toast ---- */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    padding: 12px 20px; border-radius: var(--radius-sm);
    font-size: 0.8rem; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
    opacity: 0; transform: translateY(12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none; z-index: 200;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 0 20px rgba(45, 212, 191, 0.1);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }

/* ---- Footer ---- */
footer {
    position: relative; z-index: 1;
    text-align: center;
    padding: 24px 20px 32px;
    font-size: 0.68rem; color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
}
footer a {
    color: var(--accent); text-decoration: none;
    font-weight: 500;
}
footer a:hover { text-decoration: underline; }

/* ---- Auth Gate ---- */
#authGate {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-primary);
    transition: opacity 0.4s;
}
#appContent {
    opacity: 0; transition: opacity 0.4s;
}

/* ---- Responsive ---- */
@media (max-width: 860px) {
    header { padding: 0 16px; }
    main { padding: 16px 12px 32px; }
    .card-head { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .export-bar { padding: 10px 16px; }
    .output-wrap tbody td { padding: 8px 10px; font-size: 0.72rem; }
}

/* ---- Print ---- */
@media print {
    header, footer, .upload-col, .export-bar, .toast, #authGate { display: none !important; }
    .layout { grid-template-columns: 1fr; }
    .card { border: 1px solid #ccc; }
}
