/* Markdown Table Generator Styling */

/* Editable Table */
.editable-table {
    margin-bottom: 0;
}

.editable-table td {
    padding: 4px;
}

.table-cell-input {
    border: 1px solid transparent;
    padding: 6px 8px;
    transition: all 0.2s;
}

.table-cell-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    background-color: #fff;
}

[data-bs-theme="dark"] .table-cell-input {
    background-color: #212529;
    color: #e9ecef;
    border-color: transparent;
}

[data-bs-theme="dark"] .table-cell-input:focus {
    background-color: #2d3239;
    border-color: #86b7fe;
}

/* Table Header Cells */
.table-active .table-cell-input {
    background-color: #f8f9fa;
    font-weight: 600;
}

[data-bs-theme="dark"] .table-active .table-cell-input {
    background-color: #1a1d23;
}

/* Alignment Select */
.alignment-select {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Output Textarea */
.markdown-output {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

[data-bs-theme="dark"] .markdown-output {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

/* Preview Box */
.preview-box {
    padding: 20px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    min-height: 200px;
}

[data-bs-theme="dark"] .preview-box {
    background-color: #212529;
    border-color: #495057;
}

.preview-table {
    margin-bottom: 0;
}

.preview-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

[data-bs-theme="dark"] .preview-table th {
    background-color: #1a1d23;
    color: #e9ecef;
}

[data-bs-theme="dark"] .preview-table {
    color: #e9ecef;
    border-color: #495057;
}

[data-bs-theme="dark"] .preview-table td,
[data-bs-theme="dark"] .preview-table th {
    border-color: #495057;
}

/* Button Styling */
.toolBtn {
    transition: all 0.2s ease;
    border-radius: 6px;
    font-weight: 500;
    padding: 8px 16px;
}

.toolBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.toolBtn:active {
    transform: translateY(0);
}

/* Card styling */
.card-header h5 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Form Labels */
.form-label {
    font-weight: 500;
    color: #212529;
}

[data-bs-theme="dark"] .form-label {
    color: #e9ecef;
}

.form-label.small {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

/* Form Text */
.form-text {
    font-size: 0.875rem;
    color: #6c757d;
}

[data-bs-theme="dark"] .form-text {
    color: #9ca3af;
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Number Inputs */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .toolBtn {
        width: 100%;
        margin-bottom: 5px;
    }

    .table-cell-input {
        font-size: 13px;
        padding: 4px 6px;
    }

    .editable-table {
        font-size: 14px;
    }

    .preview-box {
        padding: 12px;
    }
}

/* Loading Animation */
.toolBtn.loading {
    position: relative;
    pointer-events: none;
}

.toolBtn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

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

/* Focus States */
.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Placeholder Styling */
.table-cell-input::placeholder {
    color: #9ca3af;
    opacity: 0.6;
}

[data-bs-theme="dark"] .table-cell-input::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

/* Table borders in dark mode */
[data-bs-theme="dark"] .table-bordered {
    border-color: #495057;
}

[data-bs-theme="dark"] .table-bordered td,
[data-bs-theme="dark"] .table-bordered th {
    border-color: #495057;
}

/* Form select dark mode */
[data-bs-theme="dark"] .form-select {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-select:focus {
    background-color: #212529;
    border-color: #86b7fe;
}

/* Form control dark mode */
[data-bs-theme="dark"] .form-control {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-control:focus {
    background-color: #212529;
    border-color: #86b7fe;
}
