/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

html, body {
    height: 100%;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header - IMPROVED */
.header {
    background: linear-gradient(to right, #4776E6, #8E54E9);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
}

.header-content {
    text-align: center;
    padding: 0.5rem 0;
    position: relative;
    z-index: 1;
}

.site-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    background: linear-gradient(to right, #ffffff, #e0e0ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

.site-description {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Navigation - IMPROVED */
.main-nav {
    background-color: #ffffff;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Main content */
.main-content {
    flex: 1;
    padding-bottom: 2rem;
}

/* Cards - IMPROVED */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.1);
}

.settings-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Tabs - IMPROVED */
.tabs {
    margin-bottom: 2rem;
}

.tab-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.tab-button {
    background: #f3f4f6;
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-button i {
    margin-right: 0.5rem;
}

.tab-button.active {
    background: linear-gradient(to right, #4776E6, #8E54E9);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tab-button:hover:not(.active) {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content.active {
    display: block;
}

/* Upload area - IMPROVED */
.upload-area {
    text-align: center;
    padding: 2.5rem;
    border: 2px dashed #93c5fd;
    border-radius: 0.75rem;
    background: #eff6ff;
    margin-bottom: 1.5rem;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover {
    background: #dbeafe;
    border-color: #60a5fa;
    transform: scale(1.01);
}

.upload-area i {
    font-size: 3.5rem;
    color: #4776E6;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.upload-area:hover i {
    transform: translateY(-5px);
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: #1f2937;
}

.upload-area p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

/* File info */
.file-info {
    padding: 1rem;
    background: #f0fdf4;
    border-radius: 0.5rem;
    border: 1px solid #bbf7d0;
    margin-bottom: 1rem;
}

.file-name {
    font-weight: 500;
    color: #166534;
}

.file-size {
    font-size: 0.875rem;
    color: #16a34a;
}

/* Button group */
.button-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
}

/* Buttons - IMPROVED */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.btn i {
    margin-right: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4776E6;
    color: white;
    box-shadow: 0 4px 6px rgba(71, 118, 230, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: #3a67d7;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(71, 118, 230, 0.3);
}

.btn-danger {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-danger:hover:not(:disabled) {
    background: #fecaca;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.15);
}

.btn-gradient {
    background: linear-gradient(to right, #4776E6, #8E54E9);
    color: white;
    box-shadow: 0 4px 6px rgba(71, 118, 230, 0.25);
}

.btn-gradient:hover:not(:disabled) {
    background: linear-gradient(to right, #3a67d7, #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(71, 118, 230, 0.3);
}

.btn-success {
    background: linear-gradient(to right, #10b981, #14b8a6);
    color: white;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.25);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(to right, #059669, #0d9488);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(16, 185, 129, 0.3);
}

/* Progress */
.progress-card {
    display: none;
}

.progress-container {
    margin-top: 1rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 0.625rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, #4776E6, #8E54E9);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Settings - IMPROVED */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .full-width {
        grid-column: span 2;
    }
    
    .save-settings {
        grid-column: span 2;
        display: flex;
        justify-content: flex-end;
    }
}

.settings-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: #4776E6;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.settings-title i {
    margin-right: 0.5rem;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.setting-value {
    font-weight: bold;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.3s;
}

.setting-description {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Sliders - IMPROVED */
.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 0.5rem;
    border-radius: 0.25rem;
    background: #e5e7eb;
    outline: none;
    margin: 0.75rem 0;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: linear-gradient(to right, #4776E6, #8E54E9);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
}

.slider::-moz-range-thumb {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: linear-gradient(to right, #4776E6, #8E54E9);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    border: none;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
}

/* Text inputs */
.text-input {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.text-input:focus {
    outline: none;
    border-color: #4776E6;
    box-shadow: 0 0 0 3px rgba(71, 118, 230, 0.2);
}

/* Switches - IMPROVED */
.setting-switch {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* The switch container */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin: 5px 0;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    margin: 0;
    height: 100%;
}

/* The circle on the slider */
.switch .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

/* Checked state */
.switch input:checked + .slider {
    background: linear-gradient(to right, #4776E6, #8E54E9);
}

.switch input:focus + .slider {
    box-shadow: 0 0 1px #4776E6;
}

.switch input:checked + .slider:before {
    transform: translateX(26px);
}

/* Rounded sliders */
.switch .slider.round {
    border-radius: 24px;
}

/* Field items and format items - IMPROVED */
.field-item, .format-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.field-item:hover, .format-item:hover {
    background-color: #f9fafb;
}

/* Output tabs - IMPROVED */
.output-tabs {
    margin-top: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.output-tab-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.output-tab-button {
    background: #f3f4f6;
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.output-tab-button i {
    margin-right: 0.5rem;
}

.output-tab-button.active {
    background: linear-gradient(to right, #4776E6, #8E54E9);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.output-tab-button:hover:not(.active) {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.output-tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.output-tab-content.active {
    display: block;
    flex-grow: 1;
}

/* Fields grid - IMPROVED */
.fields-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .fields-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Format list - IMPROVED */
.format-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.format-item {
    background: #f9fafb;
    border-radius: 0.5rem;
    padding: 0.75rem;
}

/* Results - IMPROVED */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.results-header h3 {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    color: #4776E6;
}

.results-header h3 i {
    margin-right: 0.5rem;
}

.download-buttons {
    display: flex;
    gap: 0.75rem;
}

.no-results {
    text-align: center;
    padding: 3rem 0;
    color: #6b7280;
}

.no-results i {
    font-size: 3.5rem;
    color: #d1d5db;
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

/* Search - IMPROVED */
.search-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.search-input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #4776E6;
    box-shadow: 0 0 0 3px rgba(71, 118, 230, 0.2);
}

/* Table - IMPROVED */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th {
    background: linear-gradient(to right, #dbeafe, #ede9fe);
    font-weight: 600;
    text-align: left;
    padding: 1rem 0.75rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table td {
    padding: 0.875rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.results-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.results-table tbody tr:hover {
    background-color: #f3f4f6;
}

/* Pagination - IMPROVED */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    font-size: 0.875rem;
    color: #6b7280;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pagination-btn {
    padding: 0.375rem 0.875rem;
    background: #f3f4f6;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    gap: 0.375rem;
}

.page-btn {
    padding: 0.375rem 0.875rem;
    background: #f3f4f6;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s;
}

.page-btn.active {
    background: linear-gradient(to right, #4776E6, #8E54E9);
    color: white;
}

.page-btn:hover:not(.active) {
    background: #e5e7eb;
    transform: translateY(-1px);
}

/* Footer - IMPROVED */
.footer {
    background: linear-gradient(to right, #1f2937, #111827);
    color: white;
    padding: 1.5rem 0;
    margin-top: auto;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, #4776E6, #8E54E9);
}

.footer-subtitle {
    font-size: 0.875rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

/* Notification - IMPROVED */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(to right, #10b981, #14b8a6);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    font-weight: 500;
}

.notification i {
    margin-right: 0.5rem;
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tab-button, .output-tab-button {
        font-size: 0.875rem;
    }
    
    .upload-area {
        padding: 1.5rem;
    }
    
    .upload-area i {
        font-size: 2.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .download-buttons {
        flex-direction: column;
    }
}