/* Table Converter Styles */

.tool-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

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

.input-section h2 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
}

.format-selector {
    margin-bottom: 16px;
}

.format-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.format-selector select {
    width: 200px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.input-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#input-data {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    background: #f9fafb;
}

#input-data:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Options Section */
.options-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.options-section h2 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.option-group {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.option-group > label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    font-size: 14px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.option-item:last-child {
    margin-bottom: 0;
}

.option-item label {
    font-size: 14px;
    color: #4b5563;
    cursor: pointer;
}

.option-item select {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.option-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

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

.output-section h2 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
}

.format-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.format-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.format-tab:hover {
    color: #374151;
    background: #f3f4f6;
}

.format-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: #eff6ff;
}

.output-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.output-area {
    position: relative;
}

#output-data {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #f9fafb;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    margin: 0;
}

.output-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Preview Section */
.preview-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.preview-section h2 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
}

.preview-container {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #f9fafb;
    overflow-x: auto;
}

#table-preview {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-style: italic;
}

#table-preview table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#table-preview th,
#table-preview td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

#table-preview th {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
}

#table-preview tr:hover {
    background: #f9fafb;
}

#table-preview tr:last-child td {
    border-bottom: none;
}

/* Statistics Section */
.stats-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.stats-section h2 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: #f3f4f6;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 4px;
}

.stat-item span:last-child {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

/* Buttons */
.btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

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

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-secondary:active {
    background: #d1d5db;
}

/* Message Display */
.message {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    opacity: 1;
    transform: translateY(0);
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    opacity: 1;
    transform: translateY(0);
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
    opacity: 1;
    transform: translateY(0);
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Copy Animation */
.copied {
    animation: copyPulse 0.6s ease-out;
}

@keyframes copyPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background: #dbeafe; }
    100% { transform: scale(1); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .tool-container {
        padding: 16px;
        gap: 20px;
    }
    
    .input-section,
    .options-section,
    .output-section,
    .preview-section,
    .stats-section {
        padding: 16px;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .format-tabs {
        flex-wrap: wrap;
    }
    
    .input-actions,
    .output-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    #input-data,
    #output-data {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .format-selector select {
        width: 100%;
    }
    
    .option-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}