/* Main Converter Container */
.csv-converter-wrapper {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.csv-main-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Panel Header Styles */
.csv-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
    color: white;
}

.csv-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.csv-icon-box {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    flex-shrink: 0;
}

.csv-icon-box-output {
    background: rgba(255, 255, 255, 0.25);
}

.csv-icon {
    width: 20px;
    height: 20px;
    color: white;
}

.csv-header-text {
    flex: 1;
    min-width: 0;
}

.csv-panel-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: white;
    line-height: 1.3;
}

.csv-panel-subtitle {
    font-size: 0.875rem;
    margin: 0.25rem 0 0 0;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0.9;
}

.csv-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.csv-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.csv-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.csv-action-btn:active {
    transform: translateY(0);
}

/* Input Section */
.csv-input-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.csv-editor-wrapper {
    position: relative;
}

.csv-textarea {
    width: 100%;
    min-height: 300px;
    padding: 1.25rem;
    border: none;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: #fafafa;
    color: #1f2937;
    outline: none;
    transition: background-color 0.2s ease;
}

.csv-textarea:focus {
    background: #ffffff;
}

.csv-textarea::placeholder {
    color: #9ca3af;
}

.csv-status-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.csv-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    flex-shrink: 0;
    transition: background-color 0.3s ease;
}

.csv-status-indicator.active {
    background: #10b981;
    animation: pulse 2s infinite;
}

.csv-status-indicator.error {
    background: #ef4444;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.csv-status-text {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Controls Section */
.csv-controls-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.csv-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.csv-control-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.csv-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.csv-select {
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.csv-select:hover {
    border-color: #9ca3af;
}

.csv-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Switch Toggle */
.csv-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.csv-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.csv-switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.csv-switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.csv-switch input:checked + .csv-switch-slider {
    background: #667eea;
}

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

.csv-switch-label {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

/* Action Buttons */
.csv-action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.csv-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    white-space: nowrap;
}

.csv-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.csv-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

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

.csv-btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.csv-btn-secondary:hover:not(:disabled) {
    background: #f3f4f6;
    transform: translateY(-2px);
}

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

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

.csv-btn svg {
    flex-shrink: 0;
}

/* Output Section */
.csv-output-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.csv-preview-wrapper {
    position: relative;
}

.csv-preview-container {
    min-height: 300px;
    max-height: 600px;
    overflow: auto;
    background: #fafafa;
}

.csv-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    min-height: 300px;
}

.csv-empty-icon {
    width: 64px;
    height: 64px;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.csv-empty-text {
    color: #9ca3af;
    font-size: 0.9375rem;
    margin: 0;
}

/* CSV Table Styles */
.csv-table-container {
    width: 100%;
    overflow-x: auto;
}

.csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: white;
}

.csv-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.csv-table th {
    background: #f3f4f6;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
    position: relative;
    min-width: 100px;
}

.csv-table th:not(:last-child) {
    border-right: 1px solid #e5e7eb;
}

.csv-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    color: #1f2937;
    word-break: break-word;
}

.csv-table tbody tr:hover {
    background: #f9fafb;
}

.csv-table tbody tr:last-child td {
    border-bottom: none;
}

/* Error State */
.csv-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    min-height: 300px;
}

.csv-error-icon {
    width: 64px;
    height: 64px;
    color: #ef4444;
    margin-bottom: 1rem;
}

.csv-error-text {
    color: #ef4444;
    font-size: 0.9375rem;
    font-weight: 500;
    margin: 0 0 0.5rem 0;
}

.csv-error-details {
    color: #9ca3af;
    font-size: 0.875rem;
    margin: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .csv-main-container {
        gap: 1rem;
    }

    .csv-panel-header {
        padding: 0.875rem 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .csv-header-left {
        width: 100%;
    }

    .csv-header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .csv-panel-title {
        font-size: 1rem;
    }

    .csv-panel-subtitle {
        font-size: 0.8125rem;
    }

    .csv-textarea {
        min-height: 250px;
        padding: 1rem;
        font-size: 13px;
    }

    .csv-controls-section {
        padding: 1.25rem;
    }

    .csv-controls-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.25rem;
    }

    .csv-action-buttons {
        flex-direction: column;
    }

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

    .csv-preview-container {
        min-height: 250px;
        max-height: 400px;
    }

    .csv-table {
        font-size: 0.8125rem;
    }

    .csv-table th,
    .csv-table td {
        padding: 0.625rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .csv-icon-box {
        width: 36px;
        height: 36px;
    }

    .csv-icon {
        width: 18px;
        height: 18px;
    }

    .csv-action-btn {
        width: 32px;
        height: 32px;
    }

    .csv-textarea {
        min-height: 200px;
        padding: 0.875rem;
    }

    .csv-preview-container {
        min-height: 200px;
    }
}

/* Scrollbar Styling */
.csv-preview-container::-webkit-scrollbar,
.csv-textarea::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.csv-preview-container::-webkit-scrollbar-track,
.csv-textarea::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.csv-preview-container::-webkit-scrollbar-thumb,
.csv-textarea::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.csv-preview-container::-webkit-scrollbar-thumb:hover,
.csv-textarea::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
