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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.header {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.header h1 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 28px;
}

.header p {
    color: #718096;
    font-size: 16px;
}

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

.main-content {
    margin-bottom: 20px;
}

.panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.panel h2 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #68d391 0%, #48bb78 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
}

.btn-preset {
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
}

.table-designer {
    min-height: 400px;
}

.table-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.table-item {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    background: #f7fafc;
    transition: all 0.2s;
}

.table-item:hover {
    border-color: #4299e1;
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.1);
}

.table-item.active {
    border-color: #4299e1;
    background: #ebf8ff;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.table-name {
    font-weight: bold;
    color: #2d3748;
    font-size: 16px;
}

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

.btn-small {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.field-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.field-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.field-name {
    font-weight: 500;
    min-width: 100px;
}

.field-type {
    color: #4a5568;
    font-size: 12px;
    background: #edf2f7;
    padding: 2px 6px;
    border-radius: 4px;
}

.field-key {
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.primary-key {
    background: #fed7d7;
    color: #c53030;
}

.foreign-key {
    background: #d6f5d6;
    color: #2f855a;
}

.er-diagram {
    min-height: 400px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.diagram-table {
    position: absolute;
    background: white;
    border: 2px solid #4299e1;
    border-radius: 6px;
    min-width: 180px;
    cursor: move;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.diagram-table-header {
    background: #4299e1;
    color: white;
    padding: 8px 12px;
    font-weight: bold;
    font-size: 14px;
}

.diagram-field {
    padding: 6px 12px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
}

.diagram-field:last-child {
    border-bottom: none;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2d3748;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4299e1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.preset-btn {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.preset-btn:hover {
    border-color: #9f7aea;
    background: #faf5ff;
}

.preset-btn h3 {
    color: #2d3748;
    margin-bottom: 5px;
    font-size: 16px;
}

.preset-btn p {
    color: #718096;
    font-size: 12px;
}

.sql-output {
    background: #1a202c;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.bottom-panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    color: #718096;
    transition: all 0.2s;
}

.tab.active {
    color: #4299e1;
    border-bottom-color: #4299e1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        justify-content: center;
    }
    
    .preset-buttons {
        grid-template-columns: 1fr;
    }
}

.relation-line {
    position: absolute;
    background: #4299e1;
    height: 2px;
    transform-origin: left center;
    pointer-events: none;
    z-index: 10;
}


.validation-error {
    color: #e53e3e;
    font-size: 12px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.success-message {
    color: #38a169;
    font-size: 12px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mode-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
    transition: all 0.3s;
}

.mode-btn.active {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.learning-content {
    display: none;
}

.learning-content.active {
    display: block;
}

.lesson-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #4299e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.lesson-progress {
    background: #f7fafc;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
}

.progress-bar {
    background: #e2e8f0;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #68d391 0%, #48bb78 100%);
    height: 100%;
    transition: width 0.3s;
}

.quiz-question {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #9f7aea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.quiz-options {
    margin: 15px 0;
}

.quiz-option {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-option:hover {
    border-color: #9f7aea;
    background: #faf5ff;
}

.quiz-option.selected {
    border-color: #9f7aea;
    background: #e9d8fd;
}

.quiz-option.correct {
    border-color: #48bb78;
    background: #c6f6d5;
}

.quiz-option.incorrect {
    border-color: #f56565;
    background: #fed7d7;
}

.normalization-demo {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.normal-form {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    border-left: 4px solid #17a2b8;
}

.lesson-status {
    font-size: 12px;
    font-weight: 500;
    margin-top: 5px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f7fafc;
}