* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #1e293b;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(99, 102, 241, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    color: white;
    padding: 30px 40px;
    position: relative;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.header-subtitle {
    flex: 1;
    opacity: 0.9;
    font-size: 1rem;
    margin-left: 20px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 12px;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

.panel {
    background: #f8fafc;
    margin: 20px;
    padding: 28px;
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.05);
}

.panel h2 {
    color: #1e293b;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
    border-bottom: 3px solid #6366f1;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #475569;
}

input[type="text"], select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    color: #1e293b;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-operation {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: white;
    font-size: 0.9em;
    padding: 10px 18px;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.3);
}

.btn-operation:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(100, 116, 139, 0.4);
}

.btn-demo {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-demo:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-tutorial {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-tutorial:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-help {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-help:hover {
    background: rgba(255, 255, 255, 0.3);
}

.header-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.btn-explain {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    font-size: 0.85em;
    padding: 8px 14px;
}

.btn-explain:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    font-size: 0.9em;
}

.btn-tutorial:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.4);
}

.btn-help {
    background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
    color: white;
    font-size: 0.9em;
}

.btn-help:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 188, 156, 0.4);
}

.btn-explain {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    color: white;
    font-size: 0.8em;
    padding: 6px 12px;
}

.btn-explain:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(52, 73, 94, 0.4);
}

.help-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.help-icon:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.help-mode-active .help-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(52, 152, 219, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0); }
}

.quick-templates {
    margin-top: 20px;
    padding: 15px;
    background: #ecf0f1;
    border-radius: 8px;
}

.btn-template {
    background: #ecf0f1;
    border: 2px solid #bdc3c7;
    padding: 8px 12px;
    margin: 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8em;
}

.btn-template:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
    transform: translateY(-2px);
}

.input-suggestions, .condition-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background 0.2s ease;
}

.suggestion-item:hover {
    background: #f8f9fa;
}

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

.condition-input-container {
    position: relative;
}

.column-selector {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border: 2px solid #e9ecef;
}

.column-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.column-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    background: white;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.column-checkbox input[type="checkbox"] {
    margin: 0;
}

.help-modal {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.help-content {
    margin-top: 20px;
}

.help-section {
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.help-section h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.help-section ul {
    margin: 10px 0;
    padding-left: 20px;
}

.help-section code {
    background: #ecf0f1;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.help-section kbd {
    background: #2c3e50;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid #34495e;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.tutorial-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

.btn-skip {
    background: transparent;
    color: #7f8c8d;
    border: 2px solid #bdc3c7;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-skip:hover {
    background: #7f8c8d;
    color: white;
}

.tutorial-highlight {
    position: relative;
    z-index: 1001;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.8), 0 0 20px rgba(52, 152, 219, 0.5);
    border-radius: 8px;
}

.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Enhanced result styling */
.result-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.operation-badge {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
}

.result-stats {
    background: #ecf0f1;
    color: #7f8c8d;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
}

.operation-description {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.description-text {
    flex: 1;
    color: #2c3e50;
}

.operation-time {
    color: #7f8c8d;
    font-size: 0.8em;
    font-style: italic;
}

.result-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.btn-save {
    background: #27ae60;
    color: white;
}

.btn-save:hover {
    background: #229954;
}

.btn-export {
    background: #f39c12;
    color: white;
}

.btn-export:hover {
    background: #e67e22;
}

/* Animation enhancements */
.slide-in-animation {
    animation: slideInUp 0.6s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.select-result .operation-badge {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.project-result .operation-badge {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.join-result .operation-badge {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.union-result .operation-badge {
    background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
}

.difference-result .operation-badge {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}

/* Toast notifications */
.toast {
    animation: slideInRight 0.3s ease !important;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Enhanced table interactions */
.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: #e8f4f8 !important;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Interactive elements */
.form-group {
    position: relative;
}

.form-group input:focus + .input-suggestions {
    display: block;
}

/* Enhanced Mobile responsiveness for interactive elements */
@media (max-width: 768px) {
    .header-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        width: 100%;
    }
    
    .header-buttons .btn {
        width: 100%;
        max-width: 250px;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .operation-description {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .result-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .result-actions .btn {
        flex: 1;
        min-width: 120px;
    }
    
    .toast {
        right: 10px;
        left: 10px;
        max-width: none;
        border-radius: 8px;
    }
    
    /* Make form inputs more touch-friendly */
    input[type="text"], select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Improve button accessibility */
    .btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Better table scrolling on mobile */
    .table-container {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure dropdowns are accessible */
    select {
        background-size: 12px;
        background-position: calc(100% - 12px) center;
    }
}

.operation-section {
    margin-bottom: 25px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.operation-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.operation-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.examples {
    margin-top: 10px;
    padding: 8px 12px;
    background: #e8f4f8;
    border-radius: 5px;
    border-left: 3px solid #3498db;
}

.examples small {
    color: #2c3e50;
    font-style: italic;
}

.table-select {
    min-width: 180px;
}

.tables-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px;
}

.tables-section, .results-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.tables-section h2, .results-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: 500;
}

.tables-grid {
    display: grid;
    gap: 20px;
}

.table-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.table-name {
    font-size: 1.2em;
    font-weight: 600;
    color: #2c3e50;
}

.table-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add {
    background: #27ae60;
    color: white;
}

.btn-add:hover {
    background: #229954;
    transform: translateY(-1px);
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table th {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 500;
    border: 1px solid #2c3e50;
}

.data-table td {
    padding: 10px 8px;
    border: 1px solid #e9ecef;
    background: white;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.results-area {
    min-height: 80px;
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 2px dashed #bdc3c7;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.placeholder {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    margin: 0;
}

.results-empty-state {
    text-align: center;
    padding: 10px 0;
}

.results-empty-state .empty-icon {
    font-size: 2em;
    color: #bdc3c7;
    margin-bottom: 10px;
}

.results-empty-state .empty-text {
    color: #7f8c8d;
    font-style: italic;
    margin-bottom: 8px;
}

.results-empty-state .empty-hint {
    color: #95a5a6;
    font-size: 0.85em;
}

.result-item {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #27ae60;
}

.result-header {
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.operation-description {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-bottom: 15px;
    font-style: italic;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #e74c3c;
}

.row-form {
    margin: 20px 0;
}

.row-form .form-group {
    margin-bottom: 15px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* Enhanced Responsive Design - Mobile First Approach */

/* Large screens (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 20px;
    }
    
    .tables-container {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 25px;
    }
    
    .operation-form {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .panel {
        padding: 30px;
    }
}

/* Medium-large screens (992px to 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 15px;
    }
    
    .operation-form {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .tables-container {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* Medium screens (768px to 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
    }
    
    .panel {
        margin: 10px 0;
        padding: 20px;
    }
    
    header {
        padding: 20px;
        text-align: center;
    }
    
    header h1 {
        font-size: 2.2em;
        margin-bottom: 10px;
    }
    
    .header-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .operation-form {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .tables-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 0.9em;
    }
}

/* Small tablets and large phones (576px to 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .container {
        margin: 5px;
        border-radius: 10px;
        padding: 10px;
    }
    
    .panel {
        margin: 8px 0;
        padding: 15px;
        border-radius: 8px;
    }
    
    header {
        padding: 15px;
        text-align: center;
    }
    
    header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    
    header p {
        font-size: 0.9em;
        margin-bottom: 15px;
    }
    
    .header-buttons {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .header-buttons .btn {
        width: 100%;
        max-width: 280px;
        padding: 12px;
        font-size: 0.85em;
    }
    
    .operation-form {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 0.9em;
        margin-bottom: 6px;
    }
    
    input[type="text"], select, textarea {
        min-height: 44px;
        font-size: 16px;
        padding: 10px 12px;
    }
    
    .tables-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .table-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 100%;
        font-size: 0.85em;
    }
    
    th, td {
        padding: 8px 6px;
        min-width: 80px;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 0.85em;
        min-height: 44px;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .result-actions .btn {
        width: 100%;
    }
}
    
    .panel {
        margin: 15px;
        padding: 15px;
    }
    
    .tables-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .operation-form {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    header {
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    header p {
        font-size: 1em;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .table-container {
        margin-bottom: 15px;
    }
    
    .table-container table {
        font-size: 0.9em;
    }
    
    .table-container th,
    .table-container td {
        padding: 8px;
    }
}

/* Extra small screens (up to 575px) - Mobile phones */
@media (max-width: 575px) {
    body {
        padding: 5px;
    }
    
    .container {
        margin: 0;
        border-radius: 8px;
    }
    
    .panel {
        margin: 10px;
        padding: 12px;
    }
    
    header {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.5em;
        margin-bottom: 5px;
    }
    
    header p {
        font-size: 0.9em;
    }
    
    .panel h2 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .operation-form {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.8em;
        width: 100%;
    }
    
    input[type="text"], select {
        padding: 10px 12px;
        font-size: 0.9em;
    }
    
    .table-container {
        overflow-x: auto;
        margin-bottom: 10px;
    }
    
    .table-container table {
        font-size: 0.8em;
        min-width: 300px;
    }
    
    .table-container th,
    .table-container td {
        padding: 6px 8px;
    }
    
    .header-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .header-buttons .btn {
        width: 100%;
        margin: 0;
        max-width: none;
        padding: 12px 15px;
    }
    
    .form-group label {
        font-size: 0.85em;
        margin-bottom: 5px;
    }
    
    .quick-templates {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: 15px;
    }
    
    .btn-template {
        padding: 10px;
        font-size: 0.8em;
        width: 100%;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .result-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .result-actions .btn {
        width: 100%;
    }
    
    .toast {
        left: 5px;
        right: 5px;
        bottom: 20px;
        font-size: 0.85em;
    }
    
    /* Better table scrolling on mobile */
    .table-card {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        border-radius: 6px;
        overflow: hidden;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    .table-container::-webkit-scrollbar {
        height: 4px;
    }
    
    .table-container::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    .table-container::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 2px;
    }
}
    
    .quick-templates {
        text-align: center;
    }
    
    .btn-template {
        display: block;
        width: 100%;
        margin: 5px 0;
        padding: 8px;
        font-size: 0.8em;
    }
}

/* Landscape orientation adjustments for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    header {
        padding: 10px 15px;
    }
    
    header h1 {
        font-size: 1.3em;
        margin-bottom: 5px;
    }
    
    .panel {
        margin: 8px;
        padding: 10px;
    }
    
    .operation-section {
        margin-bottom: 15px;
        padding: 15px;
    }
}

/* Animation for new table creation */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.table-container {
    animation: slideInUp 0.5s ease;
}

/* Highlight animation for results */
@keyframes highlight {
    0% { background-color: #fff3cd; }
    100% { background-color: transparent; }
}

.result-highlight {
    animation: highlight 2s ease;
}

/* Basic styles for new operation sections */
.column-rename-list {
    max-height: 200px;
    overflow-y: auto;
}

.column-rename-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.column-rename-item label {
    margin: 0;
    margin-right: 10px;
    min-width: 80px;
    font-size: 0.9em;
    font-weight: 500;
}

.column-rename-item input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
}

/* ================================
   MOBILE RESPONSIVE LAYOUT ONLY
   (No color scheme changes)
   ================================ */

/* Tablet Portrait (768px - 1024px) */
@media screen and (max-width: 1024px) and (min-width: 768px) {
    .container {
        margin: 15px;
    }
    
    .panel {
        margin: 15px;
        padding: 20px;
    }
    
    .tables-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .operation-form {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .header-buttons {
        flex-wrap: wrap;
        max-width: 500px;
        margin: 15px auto 0;
    }
    
    .table-container {
        overflow-x: auto;
    }
}

/* Mobile Landscape & Small Tablet (481px - 767px) */
@media screen and (max-width: 767px) and (min-width: 481px) {
    body {
        padding: 10px;
    }
    
    .container {
        margin: 0;
        border-radius: 12px;
    }
    
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 2em;
        margin-bottom: 8px;
    }
    
    header p {
        font-size: 0.95em;
    }
    
    .header-buttons {
        flex-direction: column;
        gap: 10px;
        max-width: 300px;
        margin: 15px auto 0;
    }
    
    .panel {
        margin: 12px;
        padding: 18px;
    }
    
    .panel h2 {
        font-size: 1.3em;
    }
    
    .operation-section {
        margin-bottom: 18px;
        padding: 16px;
    }
    
    .operation-form {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .btn {
        width: 100%;
        padding: 12px 16px;
    }
    
    .btn-operation, .btn-explain {
        width: 48%;
        display: inline-block;
        margin-right: 2%;
    }
    
    .btn-explain {
        margin-right: 0;
    }
    
    .tables-container {
        grid-template-columns: 1fr;
        gap: 15px;
        margin: 15px;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-container table {
        min-width: 100%;
        font-size: 0.9em;
    }
    
    .results-area {
        min-height: 100px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 20px;
    }
}

/* Mobile Portrait (up to 480px) */
@media screen and (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .container {
        margin: 0;
        border-radius: 10px;
    }
    
    header {
        padding: 16px 12px;
    }
    
    header h1 {
        font-size: 1.7em;
        margin-bottom: 6px;
    }
    
    header p {
        font-size: 0.9em;
        margin-bottom: 12px;
    }
    
    .header-buttons {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .header-buttons .btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 0.9em;
    }
    
    .panel {
        margin: 8px;
        padding: 14px;
    }
    
    .panel h2 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .operation-section {
        margin-bottom: 15px;
        padding: 14px;
    }
    
    .operation-section h3 {
        font-size: 1.1em;
        margin-bottom: 12px;
        cursor: pointer;
        padding: 8px;
        border-radius: 6px;
        position: relative;
        user-select: none;
    }
    
    .operation-section h3:after {
        content: '▼';
        position: absolute;
        right: 8px;
        font-size: 0.8em;
        transition: transform 0.3s ease;
    }
    
    .operation-section.collapsed h3:after {
        transform: rotate(-90deg);
    }
    
    .operation-section .operation-form {
        max-height: 500px;
        overflow: hidden;
        transition: all 0.3s ease;
    }
    
    .operation-section.collapsed .operation-form {
        max-height: 0;
        padding: 0;
        margin: 0;
    }
    
    .operation-form {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    input[type="text"], select {
        padding: 14px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 8px;
    }
    
    .btn {
        width: 100%;
        padding: 14px 16px;
        font-size: 0.9em;
        border-radius: 8px;
        margin-bottom: 8px;
    }
    
    .btn-operation, .btn-explain {
        width: 100%;
        display: block;
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .btn-explain {
        margin-right: 0;
    }
    
    /* Ensure buttons don't collide */
    .operation-form .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .tables-container {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 12px;
    }
    
    .tables-section, .results-section {
        padding: 16px;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }
    
    .table-container::after {
        content: '← Scroll →';
        position: absolute;
        top: 5px;
        right: 5px;
        background: rgba(0,0,0,0.7);
        color: white;
        padding: 2px 6px;
        border-radius: 3px;
        font-size: 0.7em;
        pointer-events: none;
        opacity: 0.8;
    }
    
    .table-container table {
        min-width: 350px;
        font-size: 0.85em;
    }
    
    .table-container th,
    .table-container td {
        padding: 10px 6px;
        white-space: nowrap;
    }
    
    .results-area {
        min-height: 80px;
        padding: 12px;
    }
    
    .results-empty-state .empty-icon {
        font-size: 1.8em;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 16px;
        border-radius: 12px;
    }
    
    .quick-templates {
        margin-top: 12px;
    }
    
    .btn-template {
        display: block;
        width: 100%;
        margin: 6px 0;
        padding: 10px;
        font-size: 0.85em;
    }
    
    .column-checkboxes {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .examples {
        margin-top: 8px;
        padding: 6px 8px;
        font-size: 0.85em;
    }
}

/* Extra Small Mobile (up to 360px) */
@media screen and (max-width: 360px) {
    body {
        padding: 5px;
    }
    
    header {
        padding: 12px 8px;
    }
    
    header h1 {
        font-size: 1.5em;
        margin-bottom: 4px;
    }
    
    header p {
        font-size: 0.85em;
    }
    
    .panel {
        margin: 6px;
        padding: 12px;
    }
    
    .panel h2 {
        font-size: 1.1em;
    }
    
    .operation-section {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .operation-section h3 {
        font-size: 1em;
        padding: 6px;
    }
    
    input[type="text"], select {
        padding: 12px 10px;
    }
    
    .btn {
        padding: 12px 14px;
        font-size: 0.85em;
    }
    
    .table-container table {
        min-width: 300px;
        font-size: 0.8em;
    }
    
    .table-container th,
    .table-container td {
        padding: 8px 4px;
    }
    
    .column-checkboxes {
        grid-template-columns: 1fr;
    }
}

/* Landscape Mobile Adjustments */
@media screen and (max-height: 500px) and (orientation: landscape) {
    header {
        padding: 8px 12px;
    }
    
    header h1 {
        font-size: 1.4em;
        margin-bottom: 3px;
    }
    
    header p {
        font-size: 0.8em;
        margin-bottom: 8px;
    }
    
    .panel {
        margin: 6px;
        padding: 10px;
    }
    
    .operation-section {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .results-area {
        min-height: 60px;
        padding: 8px;
    }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
    .btn, .help-icon, .close, .operation-section h3 {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }
    
    input[type="text"], select {
        min-height: 44px;
        font-size: 16px;
    }
    
    .table-container td, .table-container th {
        min-height: 36px;
        padding: 10px 8px;
    }
}