/* style.css - Premium Dark-Tech Styling */

:root {
    --bg-main: #0a0c10;
    --bg-card: rgba(16, 20, 28, 0.65);
    --bg-card-hover: rgba(22, 28, 38, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(0, 242, 254, 0.35);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-teal: #00f2fe;
    --accent-blue: #4facfe;
    --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --success-color: #10b981;
    --danger-color: #ef4444;
    
    --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    background-image: 
        radial-gradient(at 0% 0%, rgba(0, 242, 254, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(80, 172, 254, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

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

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

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

.logo-icon {
    font-size: 2.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(0, 242, 254, 0.3));
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #ffffff 0%, #d1d5db 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.header-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 0.85rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: relative;
}

.status-indicator.online {
    background-color: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}

.status-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Grid Layout Workspace */
.workspace-grid {
    display: grid;
    grid-template-cols: 1.1fr 1.3fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

@media (max-width: 1200px) {
    .workspace-grid {
        grid-template-cols: 1fr;
    }
}

/* Card Styling */
.grid-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.grid-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.grid-card.disabled {
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
}

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

.step-badge {
    background: var(--border-color);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.05);
}

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Dropzone (Upload) */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.01);
    position: relative;
    overflow: hidden;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--border-hover);
    background: rgba(0, 242, 254, 0.02);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.05);
}

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

.icon-large {
    font-size: 2.75rem;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.dropzone:hover .icon-large {
    color: var(--accent-teal);
    transform: translateY(-4px);
}

.dropzone p.title {
    font-size: 1rem;
    font-weight: 500;
}

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

.dropzone p.subtitle span {
    color: var(--accent-teal);
    text-decoration: underline;
}

.file-limits {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* File details preview */
.file-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255,255,255,0.03);
    padding: 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: left;
    width: 100%;
}

.file-details-small {
    padding: 0.5rem;
}

.file-details .file-icon {
    font-size: 1.75rem;
    color: var(--accent-teal);
}

.file-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

.file-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.remove-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 0.25rem;
}

.remove-btn:hover {
    color: var(--danger-color);
}

/* Reference File Toggle */
.ref-container {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ref-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ref-toggle-header .label-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.ref-badge {
    font-size: 0.75rem;
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-teal);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(0, 242, 254, 0.15);
}

.dropzone-small {
    padding: 1rem;
}

.dropzone-small i {
    font-size: 1.5rem;
}

.text-link-btn {
    background: transparent;
    border: none;
    color: var(--accent-teal);
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
    align-self: flex-start;
}

.text-link-btn:hover {
    color: var(--text-primary);
}

/* Configuration Panel layout */
.config-grid {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.config-group h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 0.5rem;
}

.config-group h3 i {
    color: var(--accent-teal);
}

/* Fields & Inputs */
.input-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Custom Select Dropdowns */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper::after {
    content: "\e252"; /* Phosphor caret-down character in custom style or standard character */
    font-family: "ph";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

select {
    width: 100%;
    padding: 0.65rem 2.5rem 0.65rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

select:focus {
    outline: none;
    border-color: var(--accent-teal);
    background: rgba(255,255,255,0.06);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.1);
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

select option {
    background-color: #ffffff;
    color: #111827;
}

/* Slider Custom Styling */
.slider-field {
    margin-top: 0.5rem;
}

.slider-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-value {
    font-family: var(--font-mono);
    color: var(--accent-teal);
    font-weight: 600;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    margin: 1rem 0 0.5rem 0;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-teal);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]:disabled {
    opacity: 0.5;
}

input[type="range"]:disabled::-webkit-slider-thumb {
    background: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 0 0.25rem;
}

/* Custom Checkboxes */
.checkbox-group {
    display: flex;
    gap: 1.5rem;
    background: rgba(255,255,255,0.02);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 0.85rem;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    height: 18px;
    width: 18px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--accent-teal);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-teal);
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.checkmark::after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark::after {
    display: block;
}

.checkbox-container .checkmark::after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid black;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Switch styling for Toggle button */
.switch-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1rem 0.85rem 38px;
    border-radius: 8px;
    width: 100%;
}

.switch-container .checkmark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
}

.switch-container input:checked ~ .checkmark::after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
}

.label-text {
    display: flex;
    flex-direction: column;
}

.label-text strong {
    font-size: 0.85rem;
    font-weight: 500;
}

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

/* Third Panel: Process / Results Area */
.status-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    min-height: 250px;
}

.run-area, .progress-area, .results-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    width: 100%;
}

.run-icon {
    font-size: 3.5rem;
    color: var(--text-muted);
}

.status-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.status-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 280px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    width: 100%;
    text-decoration: none;
}

.btn-large {
    padding: 0.85rem 1.5rem;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #000000;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

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

.btn-primary:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-success {
    background: var(--success-color);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-cancel {
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
    margin-top: 1rem;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    opacity: 0.85;
}

.btn-cancel:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.6);
    opacity: 1;
    transform: none;
}

/* Spinner Loader */
.spinner-spinner {
    width: 45px;
    height: 45px;
    position: relative;
}

.double-bounce1, .double-bounce2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--accent-teal);
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    animation: sk-bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
    animation-delay: -1.0s;
    background-color: var(--accent-blue);
}

@keyframes sk-bounce {
    0%, 100% { 
        transform: scale(0.0);
    } 50% { 
        transform: scale(1.0);
    }
}

/* Progress bar filling */
.progress-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-text-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
}

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

.progress-pct {
    color: var(--accent-teal);
    font-family: var(--font-mono);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.progress-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Results & Success elements */
.success-icon {
    font-size: 4rem;
    color: var(--success-color);
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.3));
}

.stats-box {
    display: flex;
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    margin: 0.5rem 0;
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-item:first-child {
    border-right: 1px solid var(--border-color);
}

.stat-num {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-teal);
    font-family: var(--font-mono);
}

.stat-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* Footer styling */
.main-footer {
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
}

/* Mobile Responsiveness styling */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
        gap: 1.25rem;
    }
    
    .main-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
        padding-bottom: 1.25rem;
    }
    
    .logo-area {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .grid-card {
        padding: 1.25rem;
    }
    
    .radio-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem !important;
    }
}

/* Sheet Selector */
.sheet-selector-group {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.sheet-selector-header {
    margin-bottom: 0.65rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.select-all-sheets-label {
    font-size: 0.9rem;
}

.sheet-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.2rem;
    padding: 0.5rem 0;
}

.sheet-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s ease;
}

.sheet-checkbox-item:hover {
    color: var(--text-primary);
}

.sheet-checkbox-item input[type="checkbox"] {
    accent-color: var(--accent-teal);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.sheet-checkbox-item .sheet-badge {
    display: inline-block;
    background: rgba(100, 255, 218, 0.08);
    color: var(--accent-teal);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

