/* =============================================
   ICS Fusion Studio - Style Sheet
   Theme: Dark mode with cyan accent
   Typography: DM Sans + JetBrains Mono
   ============================================= */

:root {
    --bg-deep: #0a0e14;
    --bg-main: #0d1117;
    --bg-card: #151b23;
    --bg-elevated: #1c242e;
    --bg-hover: #242d3a;
    
    --border-subtle: #21262d;
    --border-default: #30363d;
    --border-accent: #00d9ff;
    
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    --accent: #00d9ff;
    --accent-hover: #33e1ff;
    --accent-glow: rgba(0, 217, 255, 0.15);
    --accent-soft: rgba(0, 217, 255, 0.1);
    
    --success: #3fb950;
    --success-soft: rgba(63, 185, 80, 0.15);
    
    --warning: #f0883e;
    --warning-soft: rgba(240, 136, 62, 0.15);
    
    --error: #f85149;
    --error-soft: rgba(248, 81, 73, 0.15);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);
    
    --transition: 200ms ease;
    --transition-slow: 400ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

/* Background Pattern */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(0, 217, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 217, 255, 0.05) 0%, transparent 40%),
        linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-main) 100%);
    pointer-events: none;
    z-index: -1;
}

.background-pattern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(var(--border-subtle) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.3;
}

/* Header */
header {
    padding: 3rem 2rem 2rem;
    text-align: center;
    animation: fadeInDown 600ms ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo h1 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.logo .highlight {
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* Main Container */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* Tabs Navigation */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    padding: 0.375rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tab svg {
    width: 18px;
    height: 18px;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tab.active {
    background: var(--accent);
    color: var(--bg-deep);
    box-shadow: var(--shadow-glow);
}

/* Panels */
.panel {
    display: none;
    animation: fadeIn 400ms ease;
}

.panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header {
    margin-bottom: 1.5rem;
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.panel-header p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.template-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.template-link svg {
    width: 16px;
    height: 16px;
}

.template-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-card);
    transition: var(--transition);
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.drop-zone.drag-over {
    transform: scale(1.01);
    box-shadow: var(--shadow-glow);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.drop-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    transition: var(--transition);
}

.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon {
    color: var(--accent);
    transform: translateY(-4px);
}

.drop-text {
    font-size: 1.0625rem;
    font-weight: 500;
    color: var(--text-primary);
}

.drop-subtext {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.file-button {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.file-button:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.file-button input {
    display: none;
}

/* Files List */
.files-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    animation: slideIn 300ms ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.file-item svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.file-remove {
    padding: 0.375rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.file-remove:hover {
    background: var(--error-soft);
    color: var(--error);
}

.file-remove svg {
    width: 16px;
    height: 16px;
    color: inherit;
}

/* CSV Preview */
.csv-preview {
    margin-top: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: fadeIn 400ms ease;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.preview-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.event-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
}

.preview-table-container {
    overflow-x: auto;
    max-height: 320px;
    overflow-y: auto;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.preview-table th,
.preview-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.preview-table th {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 1;
}

.preview-table td {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
}

.preview-table tbody tr:hover {
    background: var(--bg-hover);
}

.preview-table tbody tr:last-child td {
    border-bottom: none;
}

/* Export Options */
.export-options {
    margin-top: 1.5rem;
    animation: fadeIn 400ms ease;
}

.export-options h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.option-card {
    cursor: pointer;
}

.option-card input {
    display: none;
}

.option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: var(--transition);
}

.option-card input:checked + .option-content {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: var(--shadow-glow);
}

.option-content svg {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    transition: var(--transition);
}

.option-card input:checked + .option-content svg {
    color: var(--accent);
}

.option-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Action Bar */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    animation: fadeIn 400ms ease;
}

.stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stats strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn.primary {
    background: var(--accent);
    color: var(--bg-deep);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn.primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px var(--accent-glow);
}

.btn.primary:active {
    transform: translateY(0);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 300ms ease;
    max-width: 360px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-out {
    animation: toastOut 300ms ease forwards;
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--error);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 640px) {
    header {
        padding: 2rem 1rem 1.5rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .toast-container {
        left: 1rem;
        right: 1rem;
    }
    
    .toast {
        max-width: none;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-card);
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: var(--accent);
    color: var(--bg-deep);
}

