/* ============================================
   INFRARED - FTIR Spectrum Analyzer
   Professional Stylesheet
   ============================================ */

/* CSS Variables */
:root {
    --primary-color: #34D399;
    --primary-light: #6EE7B7;
    --primary-dark: #10B981;
    --accent-color: #20C997;
    --accent-light: #51CF66;
    --accent-dark: #12B886;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #EF4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #F0F9F7;
    --bg-tertiary: #E0F9F5;
    --border-color: #C0F0E7;
    --shadow-sm: 0 1px 3px 0 rgba(52, 211, 153, 0.1);
    --shadow: 0 4px 6px -1px rgba(52, 211, 153, 0.15);
    --shadow-lg: 0 10px 20px -3px rgba(52, 211, 153, 0.2);
    --shadow-xl: 0 20px 30px -5px rgba(52, 211, 153, 0.25);
    --radius-sm: 0;
    --radius: 0;
    --radius-lg: 0;
    --radius-xl: 0;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 50%, #D1D5DB 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 2rem 0;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(52, 211, 153, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(110, 231, 183, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 253, 250, 0.9) 100%);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 24px rgba(52, 211, 153, 0.08);
    padding: 3rem 3.5rem;
    margin-bottom: 3rem;
    border: 1.5px solid rgba(52, 211, 153, 0.15);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 50%, var(--primary-color) 100%);
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-section {
    text-align: center;
    width: 100%;
}

.logo-image {
    height: 160px;
    width: auto;
    margin-bottom: 1.5rem;
    filter: none;
    animation: fadeInDown 0.6s ease-out;
}

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

.logo-text {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.02em;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

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

/* Card Styles */
.card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 253, 250, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 2.5rem;
    border: 2px solid rgba(52, 211, 153, 0.1);
    transition: var(--transition);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(52, 211, 153, 0.03) 0%, transparent 70%);
    pointer-events: none;
}

.card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
    border-color: rgba(52, 211, 153, 0.2);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: #000000;
    padding: 2rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.card-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.card-header h2 {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-header p {
    color: #374151;
    margin: 0.5rem 0 0 0;
    width: 100%;
    font-size: 1.05rem;
}

.card-body {
    padding: 2.5rem;
    position: relative;
    z-index: 1;
}

/* Mode Tabs */
.mode-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    box-shadow: inset 0 2px 4px rgba(185, 28, 28, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 1rem 2rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.05rem;
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--primary-color);
    transform: translateX(-50%);
    transition: width 0.3s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.tab-btn:hover::before {
    width: 60%;
}

.tab-btn.active {
    background: linear-gradient(135deg, white 0%, rgba(254, 242, 242, 0.9) 100%);
    color: var(--primary-color);
    box-shadow: var(--shadow), 0 -3px 0 var(--primary-color) inset;
    font-weight: 700;
}

.tab-btn.active::before {
    width: 100%;
}

/* Upload Mode */
.upload-mode {
    display: none;
}

.upload-mode.active {
    display: block;
}

/* File Input */
.file-input-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    border: 3px dashed var(--primary-color);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(254, 242, 242, 0.9) 100%);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.file-label::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(185, 28, 28, 0.05) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.file-label:hover::before {
    opacity: 1;
}

.file-label:hover {
    border-color: var(--primary-light);
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.95) 0%, rgba(255, 255, 255, 0.95) 100%);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.file-label.drag-over {
    border-color: var(--accent-color);
    background: rgba(5, 150, 105, 0.05);
    box-shadow: 0 0 0 6px rgba(5, 150, 105, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    width: 5rem;
    height: 5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.file-text {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.file-text strong {
    color: var(--primary-color);
    font-weight: 700;
}

.file-name {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    position: relative;
    z-index: 1;
}

.file-name-editable {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    position: relative;
    z-index: 10;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    width: 100%;
    text-align: center;
    transition: var(--transition);
    cursor: text;
}

.file-name-editable:hover {
    border-color: var(--border-color);
    background: rgba(255, 255, 255, 0.8);
}

.file-name-editable:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    color: var(--text-primary);
    font-style: normal;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

.file-name-editable.has-file {
    color: var(--accent-color);
    font-weight: 600;
    font-style: normal;
    background: rgba(5, 150, 105, 0.1);
}

.file-name.has-file {
    color: var(--accent-color);
    font-weight: 600;
    font-style: normal;
    padding: 0.5rem 1rem;
    background: rgba(5, 150, 105, 0.1);
    border-radius: var(--radius);
}

/* View Toggle Group */
.view-toggle-group {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.25rem;
    border-radius: var(--radius);
    margin-right: 0.5rem;
}

.view-toggle-group .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.view-toggle-group .btn.active {
    background: var(--primary-color);
    color: white;
}

/* Spectrum List */
.spectrum-list {
    margin-top: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 253, 250, 0.95) 100%);
}

.spectrum-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(185, 28, 28, 0.1);
    transition: all var(--transition);
    position: relative;
}

.spectrum-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.spectrum-item:last-child {
    border-bottom: none;
}

.spectrum-item:hover {
    background: rgba(52, 211, 153, 0.05);
    transform: translateX(4px);
}

.spectrum-item:hover::before {
    transform: scaleY(1);
}

.spectrum-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.spectrum-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.spectrum-color-picker {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
}

.spectrum-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.spectrum-color-picker::-webkit-color-swatch {
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.spectrum-color-picker:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.spectrum-item:hover .spectrum-color {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 2px var(--primary-light);
}

.spectrum-details {
    flex: 1;
}

.spectrum-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.spectrum-name-input {
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    width: 100%;
    font-size: inherit;
    transition: var(--transition);
}

.spectrum-name-input:hover {
    border-color: var(--border-color);
    background: rgba(255, 255, 255, 0.5);
}

.spectrum-name-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

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

.spectrum-controls {
    display: flex;
    gap: 0.5rem;
}

/* Baseline Manual Controls */
.baseline-manual-controls {
    margin-top: 1rem;
}

.baseline-manual-controls .help-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
    font-style: italic;
}

.baseline-points-list {
    max-height: 150px;
    overflow-y: auto;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.baseline-point-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.baseline-point-item:last-child {
    border-bottom: none;
}

.baseline-point-remove {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.9rem;
}

/* Reference Library */
.reference-library-card {
    margin-bottom: 2rem;
}

.reference-library-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 1rem;
}

.library-search {
    grid-column: 1 / -1;
}

.library-filters {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.library-filters label {
    font-weight: 600;
    color: var(--text-primary);
}

.library-list {
    grid-column: 1;
    grid-row: 3;
}

.library-count {
    display: block;
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.library-info {
    grid-column: 2;
    grid-row: 3;
    padding: 1rem;
    background: rgba(240, 253, 250, 0.5);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: 300px;
}

.library-info .info-placeholder {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.compound-info h4 {
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.compound-info p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.compound-info strong {
    color: var(--text-primary);
}

/* Reference Intensity Bar - shown in visualization when reference is active */
.reference-intensity-bar {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(249, 115, 22, 0.1) 100%);
    border-radius: var(--radius);
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.ref-intensity-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #F59E0B;
    white-space: nowrap;
}

.reference-intensity-bar input[type="range"] {
    width: 200px;
    accent-color: #F59E0B;
    cursor: pointer;
}

.ref-intensity-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #F59E0B;
    min-width: 2.5rem;
    text-align: right;
}

.library-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.library-list select {
    height: 100%;
    min-height: 250px;
}

.reference-controls {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#referenceSearch {
    margin-bottom: 0.5rem;
}

#referenceSelect {
    height: auto !important;
    min-height: 120px;
    margin-bottom: 0.5rem;
}

#referenceSelect option {
    padding: 0.5rem;
    cursor: pointer;
}

#referenceSelect option:hover {
    background-color: var(--bg-tertiary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
    position: relative;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-light) 100%);
    color: white;
    box-shadow: var(--shadow);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #EF4444 100%);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

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

.btn > * {
    position: relative;
    z-index: 1;
}

/* Control Group */
.control-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Visualization Layout */
.viz-layout {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    min-height: 600px;
    align-items: stretch;
    width: 100%;
}

.viz-layout.no-panel {
    /* When panel is hidden, plot takes full width */
}

/* Preprocessing Panel */
.preprocess-panel {
    flex: 0 0 280px;
    width: 280px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 253, 250, 0.95) 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
    height: 600px;
    max-height: 600px;
    overflow-y: auto;
    display: none;
    position: relative;
}

.preprocess-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

.preprocess-panel.active {
    display: block;
    animation: slideInLeft 0.4s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.panel-title {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary-color);
    position: relative;
}

.panel-title::after {
    content: '⚙️';
    position: absolute;
    right: 0;
    top: 0;
    font-size: 1.5rem;
}

.control-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius);
    border: 1px solid rgba(52, 211, 153, 0.1);
    box-shadow: 0 2px 4px rgba(52, 211, 153, 0.05);
    transition: var(--transition);
}

.control-section:hover {
    box-shadow: var(--shadow);
    border-color: rgba(52, 211, 153, 0.2);
}

.control-section:last-child {
    border-bottom: none;
}

.control-section.export-section {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-color: rgba(59, 130, 246, 0.2);
}

.control-section.export-section h4 {
    color: #3B82F6;
}

.control-section.export-section .btn {
    margin-bottom: 0.5rem;
}

.control-section.export-section .btn:last-child {
    margin-bottom: 0;
}

.control-section h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-section h4::before {
    content: '▸';
    color: var(--primary-light);
    font-weight: bold;
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all var(--transition);
    background: white;
    font-weight: 500;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.1);
    transform: translateY(-1px);
}

.form-range {
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--bg-tertiary) 0%, rgba(185, 28, 28, 0.1) 100%);
    border-radius: 1rem;
    outline: none;
    margin-top: 0.5rem;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(185, 28, 28, 0.3);
    transition: all var(--transition);
}

.form-range::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.4);
}

.manual-offset-control {
    margin-top: 0.75rem;
}

.manual-offset-control label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Plot Container */
.plot-container {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    height: 600px;
    flex: 1 1 0%;
    min-width: 0;
    padding: 0;
    position: relative;
    box-sizing: border-box;
    display: block;
    overflow: hidden;
}

/* Force Plotly internal elements to fill container */
.plot-container .plotly,
.plot-container .svg-container,
.plot-container .main-svg {
    width: 100% !important;
    height: 100% !important;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-item {
    padding: 1.75rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 253, 250, 0.95) 100%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.info-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 50%, var(--primary-color) 100%);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

.info-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(52, 211, 153, 0.15);
    border-color: var(--primary-light);
}

.info-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.info-label::before {
    content: '▸';
    color: var(--primary-color);
    font-weight: bold;
}

.info-value {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 253, 250, 0.95) 100%);
    backdrop-filter: blur(15px);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-top: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 2px solid rgba(52, 211, 153, 0.1);
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 50%, var(--primary-color) 100%);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

.footer::after {
    content: '🧪⚛️🔬';
    position: absolute;
    top: 50%;
    left: 2rem;
    transform: translateY(-50%);
    font-size: 1.5rem;
    opacity: 0.3;
}

.footer p {
    color: var(--text-secondary);
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
}

.footer-credits {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(52, 211, 153, 0.2);
}

.footer-credits p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
    font-weight: 500;
}

.footer-credits a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 600;
}

.footer-credits a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 4rem;
    height: 4rem;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Import Preview Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.import-preview-modal {
    width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.preview-info {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.preview-table-container {
    max-height: 300px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

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

.preview-table th,
.preview-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.preview-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.preview-table tr.skipped {
    background: rgba(239, 68, 68, 0.1);
    text-decoration: line-through;
    color: var(--text-light);
}

.preview-table tr.skipped td {
    color: var(--text-light);
}

.preview-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.preview-table tbody tr:hover:not(.skipped) {
    background: var(--bg-tertiary);
}

.preview-table .row-number {
    color: var(--text-light);
    font-size: 0.75rem;
    width: 40px;
    text-align: center;
}

.preview-table .col-freq {
    background: rgba(52, 211, 153, 0.1);
}

.preview-table .col-intensity {
    background: rgba(245, 158, 11, 0.1);
}

.import-config {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.config-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.config-row:last-child {
    margin-bottom: 0;
}

.config-item {
    flex: 1;
    min-width: 150px;
}

.config-item label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.config-item select {
    width: 100%;
}

.skip-rows-input {
    flex: 1.5;
}

.skip-rows-input input {
    width: 100%;
}

.skip-rows {
    flex: 1.5;
}

.skip-rows-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    min-height: 2.2rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 420px;
}

.notification {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 253, 250, 0.95) 100%);
    backdrop-filter: blur(15px);
    padding: 1.25rem 1.75rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border-left: 5px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideInBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 2px solid rgba(52, 211, 153, 0.1);
}

@keyframes slideInBounce {
    0% {
        transform: translateX(500px) scale(0.8);
        opacity: 0;
    }
    60% {
        transform: translateX(-20px) scale(1.05);
        opacity: 1;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.notification.success {
    border-left-color: var(--success-color);
    border-color: rgba(5, 150, 105, 0.2);
}

.notification.error {
    border-left-color: var(--danger-color);
    border-color: rgba(239, 68, 68, 0.2);
}

.notification.warning {
    border-left-color: var(--warning-color);
    border-color: rgba(245, 158, 11, 0.2);
}

.notification-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.notification-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .viz-layout {
        grid-template-columns: 1fr;
    }
    
    .preprocess-panel {
        max-height: none;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem 0;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .header {
        padding: 1.5rem;
    }
    
    .logo-text {
        font-size: 2rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .control-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .notification-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .logo-text {
        font-size: 1.75rem;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .file-label {
        padding: 2rem 1rem;
    }
    
    .upload-icon {
        width: 3rem;
        height: 3rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
