/* ==========================================================================
   Trama Tech Table Cleaner - Modern Dark Glassmorphism Stylesheet
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-dark: #050505;
    --bg-surface: #0b0f19;
    --bg-surface-elevated: #151d2a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);

    /* Accents */
    --accent-color: #00ff88;
    --accent-secondary: #00ccff;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --primary-glow: rgba(139, 92, 246, 0.25);
    
    --secondary: #06b6d4;
    --secondary-hover: #0891b2;
    --secondary-glow: rgba(6, 182, 212, 0.25);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;

    /* Text Colors */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    /* Typography */
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-code: 'Fira Code', monospace;

    /* Spacing & Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.2s ease-in-out;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.5;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(0, 255, 136, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Layout Wrapper */
.app-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-height: 100vh;
}

/* Top Site Header Navigation */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.75rem;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 1.1rem;
}

.brand-logo-img {
    height: 32px;
    width: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent-color);
}

/* Card Component (Glassmorphism) */
.card {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* App Banner Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.logo-container h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.badge-pill {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-code);
    font-size: 0.75rem;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-sm {
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}

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

.btn-secondary {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: var(--border-hover);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-secondary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.btn-link-subtle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-link-subtle:hover {
    color: var(--accent-color);
}

/* Main Workspace Grid */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    flex: 1;
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.4);
}

.panel-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.step-num {
    width: 24px;
    height: 24px;
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.panel-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
}

.input-tabs, .output-tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.8);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.tab-btn {
    padding: 0.4rem 0.85rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

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

.tab-btn.active {
    background: rgba(139, 92, 246, 0.25);
    color: white;
    border: 1px solid rgba(139, 92, 246, 0.4);
}

.panel-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 1;
    overflow-y: auto;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Drop Zone Component */
.drop-zone {
    border: 2px dashed rgba(139, 92, 246, 0.35);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.4);
    cursor: pointer;
    transition: var(--transition);
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.08);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.upload-icon-wrapper {
    width: 60px;
    height: 60px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a78bfa;
}

.drop-primary {
    font-size: 0.95rem;
    color: var(--text-main);
}

.drop-secondary {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.btn-clear-file {
    background: none;
    border: none;
    color: #6ee7b7;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

/* Paste Zone Component */
.paste-zone-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.paste-zone-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.paste-editable {
    min-height: 140px;
    max-height: 220px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.paste-editable:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.paste-editable[placeholder]:empty:before {
    content: attr(placeholder);
    color: var(--text-dim);
}

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

/* Settings Card */
.settings-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

.settings-title h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-with-suffix {
    display: flex;
    align-items: center;
    background: rgba(9, 13, 22, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.form-input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: rgba(9, 13, 22, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-code);
    font-size: 0.8rem;
    outline: none;
}

.input-with-suffix .form-input {
    border: none;
}

.input-suffix {
    padding: 0 0.5rem;
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: var(--font-code);
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.03);
    height: 100%;
    display: flex;
    align-items: center;
}

.padding-input-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.quick-chips {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.chip-btn {
    padding: 0.2rem 0.5rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-family: var(--font-code);
    cursor: pointer;
    transition: var(--transition);
}

.chip-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Toggle Control Switch */
.toggles-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
}

.toggle-control input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 32px;
    height: 18px;
    background: rgba(51, 65, 85, 0.8);
    border-radius: var(--radius-full);
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.toggle-control input[type="checkbox"]:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-control input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(14px);
}

.toggle-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.toggle-label code {
    font-family: var(--font-code);
    color: #a78bfa;
}

/* Output Toolbar & Stats */
.output-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: rgba(15, 23, 42, 0.3);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.table-stats {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stat-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.stat-badge strong {
    color: var(--accent-color);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Multi Table Selector Nav */
.multi-table-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.25rem;
    background: rgba(30, 41, 59, 0.4);
    border-bottom: 1px solid var(--border-color);
}

.multi-table-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.multi-table-chips {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
}

.tbl-nav-btn {
    padding: 0.2rem 0.6rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

.tbl-nav-btn.active {
    background: rgba(139, 92, 246, 0.25);
    color: white;
    border-color: var(--primary);
}

/* Output Body View Pane */
.output-body {
    padding: 0;
    position: relative;
    min-height: 400px;
}

.output-content {
    display: none;
    height: 100%;
    width: 100%;
}

.output-content.active {
    display: block;
}

.code-container {
    height: 100%;
    min-height: 400px;
    background: #060911;
    padding: 1.25rem;
    overflow: auto;
}

.code-container pre {
    margin: 0;
}

.code-container code {
    font-family: var(--font-code);
    font-size: 0.825rem;
    color: #e2e8f0;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Preview Container */
.preview-container {
    padding: 1.25rem;
    height: 100%;
    min-height: 400px;
    overflow: auto;
    background: #090d16;
}

.preview-scroll-wrapper table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(15, 23, 42, 0.8);
    color: #f8fafc;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.preview-scroll-wrapper th {
    background: rgba(30, 41, 59, 0.9);
    color: var(--accent-color);
    font-weight: 600;
    text-align: left;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 4rem 1.5rem;
    color: var(--text-dim);
    text-align: center;
}

.empty-state p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

.empty-state span {
    font-size: 0.8rem;
}

/* Footer Section */
.app-footer {
    padding: 1.25rem 1.75rem;
}

.footer-info h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.footer-info ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.footer-info li {
    font-size: 0.825rem;
    color: var(--text-muted);

}

.footer-info li strong {
    color: var(--text-main);
}

/* Toast Notification Overlay */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .site-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }

    .output-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}
