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

:root {
    --bg-color: #080710;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(124, 58, 237, 0.4);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --primary-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #ec4899 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --accent-color: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.15);
    --font-sans: 'Inter', 'Noto Sans KR', sans-serif;
    --font-display: 'Outfit', 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Background Blobs (Premium Glow Effect) */
.background-decorations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.25;
    animation: floatBlob 25s infinite ease-in-out alternate;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: #7c3aed;
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 600px;
    height: 600px;
    background: #ec4899;
    bottom: -150px;
    left: -150px;
    animation-delay: -5s;
    animation-duration: 30s;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: #3b82f6;
    top: 40%;
    left: 30%;
    opacity: 0.15;
    animation-delay: -10s;
}

@keyframes floatBlob {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(50px, 80px) scale(1.15);
    }
}

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

/* Header with Back Button */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3.5rem;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.back-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(-2px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.8rem;
    letter-spacing: -0.5px;
}

.logo-icon {
    font-size: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text {
    color: var(--text-primary);
}

.logo-text .highlight {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-tag {
    font-size: 0.85rem;
    color: #34d399;
    background: rgba(52, 211, 153, 0.08);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    border: 1px solid rgba(52, 211, 153, 0.15);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-section h1 {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #ffffff, #d8b4fe, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .hero-section h1 {
        font-size: 2.25rem;
    }
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .header-left {
        width: 100%;
        justify-content: space-between;
    }
    .header-tag {
        align-self: flex-start;
    }
}

/* Glass Card Component */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.card:hover {
    border-color: var(--card-hover-border);
    box-shadow: 0 12px 40px 0 rgba(124, 58, 237, 0.15);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.card-title i {
    color: var(--accent-color);
}

/* Rules Section */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.rule-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.rule-item:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(4px);
}

.rule-icon {
    font-size: 1.25rem;
    color: var(--accent-color);
    background: rgba(168, 85, 247, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rule-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.rule-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.rule-info code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-family: monospace;
    color: #e9d5ff;
}

/* Target Columns Expandable Box */
.target-columns-box {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1rem;
}

.toggle-columns-btn {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.toggle-columns-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.columns-list-collapsed {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.columns-list-expanded {
    max-height: 350px;
    overflow-y: auto;
    margin-top: 0.75rem;
    padding-right: 0.5rem;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.columns-list-expanded ol {
    padding-left: 1.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
}

.columns-list-expanded ol li {
    padding: 0.15rem 0;
}

/* Custom scrollbar for column list */
.columns-list-expanded::-webkit-scrollbar {
    width: 4px;
}
.columns-list-expanded::-webkit-scrollbar-track {
    background: transparent;
}
.columns-list-expanded::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

/* Upload Zone Card */
.upload-zone-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dropzone-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 320px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
}

.dropzone-card.dragover {
    border-color: var(--accent-color);
    background: rgba(168, 85, 247, 0.06);
    transform: scale(1.02);
}

.dropzone-content {
    text-align: center;
    pointer-events: none;
}

.upload-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s ease;
}

.dropzone-card:hover .upload-icon-wrapper,
.dropzone-card.dragover .upload-icon-wrapper {
    transform: translateY(-5px);
    background: var(--primary-gradient);
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.3);
    border-color: transparent;
}

.cloud-icon {
    font-size: 2.25rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.dropzone-card:hover .cloud-icon,
.dropzone-card.dragover .cloud-icon {
    color: #ffffff;
}

.dropzone-content h2 {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.dropzone-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.file-limits {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.35rem 0.75rem;
    border-radius: 100px;
}

/* File Info Card */
.file-info-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-details {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    position: relative;
}

.file-icon {
    font-size: 2rem;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-meta h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
    word-break: break-all;
    padding-right: 2rem;
}

.file-meta p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.remove-file-btn {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    transform: translateY(-50%) rotate(90deg);
}

/* Status Indicators */
.processing-status {
    display: flex;
    justify-content: center;
    align-items: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.processing {
    background: rgba(168, 85, 247, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Interactive Buttons */
.action-buttons {
    width: 100%;
}

.btn {
    width: 100%;
    padding: 1rem 2rem;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.25);
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.4);
}

.btn-primary:not(:disabled):active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
    box-shadow: none;
}

/* Success download highlight */
.btn-success-anim {
    background: var(--success-gradient) !important;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3) !important;
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 4px 30px rgba(16, 185, 129, 0.6);
    }
    100% {
        box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    }
}

/* Preview Section */
.preview-card {
    margin-top: 1rem;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 1rem;
}

.preview-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-header h2 i {
    color: var(--accent-color);
}

.preview-subtitle {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.badge {
    background: rgba(168, 85, 247, 0.15);
    color: #d8b4fe;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

/* Data Table Styling */
.table-container {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    max-height: 450px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.preview-table th {
    background: rgba(20, 16, 40, 0.95);
    color: #e9d5ff;
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    position: sticky;
    top: 0;
    white-space: nowrap;
    z-index: 10;
}

.preview-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    white-space: nowrap;
}

.preview-table tbody tr {
    transition: background-color 0.2s ease;
}

.preview-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Custom scrollbar for tables */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.table-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
.table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}
.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Highlight dynamic formats in table cells */
.highlight-date-format {
    color: #34d399;
    font-weight: 500;
    background: rgba(52, 211, 153, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.empty-cell-placeholder {
    color: rgba(255, 255, 255, 0.15);
    font-style: italic;
    font-size: 0.8rem;
}

/* Footer styling */
.app-footer {
    margin-top: auto;
    padding: 3rem 0 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Config Form Styles */
.config-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 0.5rem;
}

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

.form-group label {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tooltip {
    color: var(--text-secondary);
    cursor: help;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.tooltip:hover {
    color: var(--accent-color);
}

.form-input, .form-select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    outline: none;
    font-size: 0.85rem;
    width: 100%;
    transition: all 0.3s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--card-hover-border);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.form-select option {
    background: #080710;
    color: #fff;
}

/* Toggle Switch Slider */
.switch input:checked + .slider {
    background: var(--primary-gradient);
}

.switch input:focus + .slider {
    box-shadow: 0 0 1px #3b82f6;
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
