/* ============================================
   DEDUPLICATOR PRO — roadmap.sourceless.net Theme
   Fonts: Orbitron, Rajdhani, Share Tech Mono
   ============================================ */

:root {
    /* --- Colors from roadmap.sourceless.net --- */
    --bg:           #020408;
    --bg2:          #050c14;
    --bg3:          #071020;
    --green:        #A4F957;
    --green-dim:    rgba(164, 249, 87, 0.55);
    --green-glow:   rgba(164, 249, 87, 0.2);
    --green-border: rgba(164, 249, 87, 0.18);
    --green-bg:     rgba(164, 249, 87, 0.06);
    --purple:       #635AE4;
    --cyan:         #00e5ff;
    --gold:         #ffc857;
    --text:         #e0f0e8;
    --text-dim:     rgba(200, 230, 215, 0.55);
    --text-muted:   rgba(200, 230, 215, 0.3);

    /* --- Danger (duplicates) --- */
    --red:          #FF003C;
    --red-dim:      rgba(255, 0, 60, 0.55);
    --red-glow:     rgba(255, 0, 60, 0.25);
    --red-border:   rgba(255, 0, 60, 0.35);
    --red-bg:       rgba(255, 0, 60, 0.07);

    /* --- Typography --- */
    --font-heading: 'Orbitron', monospace;
    --font-body:    'Rajdhani', sans-serif;
    --font-mono:    'Share Tech Mono', monospace;

    /* --- Layout --- */
    --radius:       2px;
    --panel-border: 1px solid var(--green-border);
}

/* =====================
   Reset & Base
   ===================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    position: relative;
    padding: 2rem 1rem 4rem;
}

/* =====================
   Background
   ===================== */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(164, 249, 87, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(164, 249, 87, 0.04) 1px, transparent 1px);
    background-size: 44px 44px;
    z-index: 0;
    pointer-events: none;
}

.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    z-index: 0;
    pointer-events: none;
    animation: orb-drift 18s ease-in-out infinite alternate;
}

.glow-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(164, 249, 87, 0.12), transparent 70%);
    top: -150px; left: -150px;
}

.glow-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(99, 90, 228, 0.1), transparent 70%);
    bottom: -200px; right: -150px;
    animation-delay: -8s;
}

@keyframes orb-drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(60px, 80px) scale(1.08); }
}

/* =====================
   Layout
   ===================== */
.app-container {
    width: 100%;
    max-width: 900px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* =====================
   Hero / Header
   ===================== */
.hero {
    text-align: center;
    padding: 1rem 0 0.5rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.logo-icon {
    width: 56px; height: 56px;
    border: 1px solid var(--green-border);
    background: var(--green-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
    position: relative;
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, var(--green), transparent 60%);
    clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
    z-index: -1;
}

.icon-logo {
    color: var(--green);
    width: 28px;
    height: 28px;
}

.logo-text { text-align: left; }

.logo h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    color: var(--text);
    text-transform: uppercase;
    line-height: 1;
}

.logo h1 .accent {
    background: linear-gradient(90deg, #A4F957 0%, #9fdd74 40%, #635AE4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.25em;
    margin-top: 4px;
}

.subtitle {
    color: var(--text-dim);
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 400;
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.6;
}

/* =====================
   Panel (card)
   ===================== */
.panel {
    background: var(--bg2);
    border: var(--panel-border);
    padding: 2.5rem;
    position: relative;
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.panel::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 18px; height: 18px;
    background: var(--green);
    clip-path: polygon(0 0, 100% 100%, 100% 0);
    opacity: 0.6;
}

/* =====================
   Upload Section
   ===================== */
.upload-section {
    cursor: pointer;
    text-align: center;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.upload-section:hover, .upload-section.dragover {
    border-color: var(--green);
    background: rgba(164, 249, 87, 0.04);
}

.upload-section.dragover {
    box-shadow: 0 0 30px var(--green-glow);
}

.icon-circle {
    width: 80px; height: 80px;
    border: 1px solid var(--green-border);
    background: var(--green-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    clip-path: polygon(10px 0%, calc(100% - 10px) 0%, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0% calc(100% - 10px), 0% 10px);
}

.icon-upload {
    color: var(--green);
    width: 36px;
    height: 36px;
}

.upload-content h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.upload-content p {
    color: var(--text-dim);
    font-size: 1rem;
    font-weight: 400;
}

.browse-btn {
    color: var(--green);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--green-dim);
    cursor: pointer;
}

.file-types {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.75rem;
}

.badge {
    background: var(--green-bg);
    padding: 5px 14px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--green);
    border: 1px solid var(--green-border);
    letter-spacing: 0.1em;
    clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
}

/* =====================
   Processing Section
   ===================== */
.hidden { display: none !important; }

.processing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--green-border);
}

.file-name-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.file-icon {
    color: var(--green);
    width: 20px; height: 20px;
    flex-shrink: 0;
}

.processing-header h2 {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--green);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =====================
   Stats Grid
   ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg3);
    border: 1px solid var(--green-border);
    padding: 1.5rem 1rem;
    text-align: center;
    position: relative;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    transition: box-shadow 0.3s;
}

.stat-card:hover {
    box-shadow: 0 0 20px var(--green-glow);
}

.stat-card.danger {
    border-color: var(--red-border);
}
.stat-card.danger:hover {
    box-shadow: 0 0 20px var(--red-glow);
}

.stat-card.success {
    border-color: rgba(164, 249, 87, 0.45);
}

.stat-icon {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--green);
}

.stat-card.danger .stat-icon { color: var(--red); }

.stat-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--green);
    line-height: 1;
}

.stat-card.danger .stat-value { color: var(--red); }

/* =====================
   Column Selection
   ===================== */
.columns-section {
    margin-bottom: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--green-border);
}

.columns-section h4 {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--green);
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.small-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 400;
    line-height: 1.5;
}

.selection-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.6rem;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 6px;
}

.columns-grid::-webkit-scrollbar { width: 4px; }
.columns-grid::-webkit-scrollbar-track { background: var(--bg3); }
.columns-grid::-webkit-scrollbar-thumb {
    background: var(--green-border);
    border-radius: 4px;
}

.column-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg3);
    border: 1px solid var(--green-border);
    cursor: pointer;
    transition: all 0.2s ease;
    clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
}

.column-item:hover {
    background: var(--green-bg);
    border-color: var(--green);
}

.column-item input[type="checkbox"] {
    accent-color: var(--green);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.column-item span {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-dim);
}

/* =====================
   Legend Bar
   ===================== */
.legend-bar {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg3);
    border-left: 2px solid var(--green);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

.legend-dot {
    width: 10px; height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-unique .legend-dot  { background: var(--green-border); border: 1px solid var(--green); }
.legend-duplicate .legend-dot { background: var(--red-bg); border: 1px solid var(--red); }

/* =====================
   Preview Table
   ===================== */
.table-wrapper {
    margin-bottom: 1.5rem;
    border: 1px solid var(--green-border);
}

.table-scroll {
    overflow: auto;
    max-height: 360px;
}

.table-scroll::-webkit-scrollbar { width: 5px; height: 5px; }
.table-scroll::-webkit-scrollbar-track { background: var(--bg3); }
.table-scroll::-webkit-scrollbar-thumb { background: var(--green-border); border-radius: 4px; }

#preview-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.875rem;
}

#preview-table thead tr {
    background: var(--bg3);
    position: sticky;
    top: 0;
    z-index: 2;
}

#preview-table th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--green);
    border-bottom: 1px solid var(--green-border);
    white-space: nowrap;
}

#preview-table td {
    padding: 0.55rem 1rem;
    border-bottom: 1px solid rgba(164, 249, 87, 0.06);
    color: var(--text-dim);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Row Number Column */
#preview-table th:first-child,
#preview-table td:first-child {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 50px;
    text-align: center;
    border-right: 1px solid var(--green-border);
}

/* Unique row */
#preview-table tbody tr.row-unique td {
    color: var(--green);
}

#preview-table tbody tr.row-unique:hover td {
    background: var(--green-bg);
}

/* Duplicate row */
#preview-table tbody tr.row-duplicate td {
    background: var(--red-bg);
    color: var(--red);
    border-bottom-color: rgba(255, 0, 60, 0.1);
}

#preview-table tbody tr.row-duplicate td:first-child {
    font-weight: 700;
}

#preview-table tbody tr.row-duplicate:hover td {
    background: rgba(255, 0, 60, 0.12);
}

/* First-occurrence label */
#preview-table tbody tr.row-first-occurrence td {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

#preview-table tbody tr.row-first-occurrence td:first-child {
    color: #ffffff;
    font-weight: 700;
}


/* =====================
   Action Footer
   ===================== */
.action-footer {
    display: flex;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--green-border);
    flex-wrap: wrap;
}

/* Primary button */
.btn-primary {
    flex: 1;
    min-width: 200px;
    padding: 1rem 1.5rem;
    border: none;
    background: var(--green);
    color: var(--bg);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    cursor: pointer;
    transition: all 0.25s ease;
    clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
    text-transform: uppercase;
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.15);
    box-shadow: 0 0 25px var(--green-glow);
}

.btn-primary:disabled {
    filter: grayscale(0.7);
    opacity: 0.4;
    cursor: not-allowed;
}

/* Secondary button */
.btn-secondary {
    flex: 1;
    min-width: 200px;
    padding: 1rem 1.5rem;
    background: transparent;
    border: 1px solid var(--red-border);
    color: var(--red);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    cursor: pointer;
    transition: all 0.25s ease;
    clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
    text-transform: uppercase;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--red-bg);
    box-shadow: 0 0 25px var(--red-glow);
}

.btn-secondary:disabled {
    filter: grayscale(0.7);
    opacity: 0.4;
    cursor: not-allowed;
}

/* Icon button */
.btn-icon {
    background: transparent;
    border: 1px solid var(--green-border);
    color: var(--text-muted);
    width: 40px; height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
    flex-shrink: 0;
}

.btn-icon:hover {
    background: rgba(255, 0, 60, 0.1);
    border-color: var(--red-border);
    color: var(--red);
}

/* Text button */
.btn-text {
    background: transparent;
    border: 1px solid var(--green-border);
    color: var(--text-muted);
    padding: 6px 14px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
}

.btn-text:hover {
    background: var(--green-bg);
    color: var(--green);
    border-color: var(--green);
}

.btn-text i { width: 14px; height: 14px; }

/* =====================
   Footer
   ===================== */
.app-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}

.app-footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.app-footer i {
    color: var(--green);
    width: 14px; height: 14px;
}

/* =====================
   Responsive
   ===================== */
@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
    .logo h1 { font-size: 1.4rem; }
    .panel { padding: 1.5rem; }
    .action-footer { flex-direction: column; }
    .btn-primary, .btn-secondary { min-width: unset; width: 100%; }
    .export-format-row { flex-wrap: wrap; }
}

/* =====================
   Legend — First Occurrence
   ===================== */
.legend-first .legend-dot {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid #ffffff;
}

.legend-unique .legend-dot {
    background: var(--green-bg);
    border: 1px solid var(--green);
}


.preview-notice {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--gold);
    letter-spacing: 0.05em;
}

/* First occurrence row */
#preview-table tbody tr.row-first-occurrence td {
    background: rgba(164, 249, 87, 0.05);
    color: var(--text);
    border-bottom-color: rgba(164, 249, 87, 0.08);
}

#preview-table tbody tr.row-first-occurrence td:first-child {
    color: var(--green-dim);
}

/* =====================
   Export Format Selector
   ===================== */
.export-format-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    background: var(--bg3);
    border-left: 2px solid var(--purple);
}

.format-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.format-toggle {
    display: flex;
    gap: 0;
}

.format-btn {
    background: transparent;
    border: 1px solid var(--green-border);
    color: var(--text-muted);
    padding: 5px 18px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.format-btn:first-child {
    clip-path: polygon(6px 0%, 100% 0%, 100% 100%, 0% 100%);
    border-right: none;
}

.format-btn:last-child {
    clip-path: polygon(0% 0%, calc(100% - 6px) 0%, 100% 100%, 0% 100%);
    border-left: none;
}

.format-btn.active {
    background: var(--green-bg);
    border-color: var(--green);
    color: var(--green);
}

.format-btn:hover:not(.active) {
    background: rgba(255,255,255,0.03);
    color: var(--text-dim);
}

.format-hint {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--gold);
    letter-spacing: 0.05em;
}

