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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    padding: 0;
    color: #1e293b;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 32px 40px;
    border-radius: 16px;
    margin-bottom: 32px;
    box-shadow: 0 10px 25px -5px rgba(102, 126, 234, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.header h1 {
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.5px;
}

.header .btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

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

h2 {
    color: #0f172a;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.3px;
}

h3 {
    color: #1e293b;
    font-size: 20px;
    font-weight: 600;
    margin: 48px 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 1px;
}

h4 {
    color: #334155;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
}

.form-group {
    margin-bottom: 24px;
    width: 100%;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.1px;
}

input[type="text"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
    box-sizing: border-box;
    color: #1e293b;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: #fafbfc;
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

textarea::placeholder {
    color: #94a3b8;
}

.theory-editor {
    min-height: 180px;
    padding: 16px 18px;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    font-size: 14px;
    color: #0f172a;
}

input[type="file"] {
    padding: 16px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    width: 100%;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
}

input[type="file"]:hover {
    border-color: #667eea;
    background: #f1f5f9;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(102, 126, 234, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: #64748b;
    box-shadow: 0 4px 6px -1px rgba(100, 116, 139, 0.3);
}

.btn-secondary:hover {
    background: #475569;
    box-shadow: 0 10px 15px -3px rgba(100, 116, 139, 0.4);
}

.btn-danger {
    background: #ef4444;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 10px 15px -3px rgba(220, 38, 38, 0.4);
}

.danger {
    color: #ef4444;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.danger:hover {
    text-decoration: underline;
}

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

th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: white;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
    vertical-align: middle;
}

tr:hover {
    background: #f8fafc;
}

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

.step-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.step-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.15);
}

.step-card-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.08) 100%);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: all 0.2s;
}

.step-card-header:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.15) 100%);
}

.step-card-header h4 {
    margin: 0;
    color: #1e293b;
    font-size: 18px;
    font-weight: 700;
}

.step-card-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
    color: #667eea;
}

.step-card.active .step-card-icon {
    transform: rotate(180deg);
}

.step-card-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.step-card.active .step-card-content {
    max-height: 10000px;
    padding: 24px;
}

.step-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 20px;
}

.step-header input,
.step-header select {
    margin: 0;
}

.rules-panel {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
}

.rules-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.rules-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.rule-field {
    display: flex;
    flex-direction: column;
}

.rule-field label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rule-field input {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 500;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fafbfc;
    transition: all 0.2s;
}

.rule-field input:focus {
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.rule-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.initial-state-card,
.reaction-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.initial-state-card:hover,
.reaction-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.color-config {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.12) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
}

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

.color-field {
    background: white;
    border-radius: 10px;
    padding: 16px;
    border: 2px solid #e2e8f0;
    transition: all 0.2s;
}

.color-field:hover {
    border-color: #667eea;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.1);
}

.color-field label {
    font-size: 12px;
    color: #475569;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-field input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    transition: all 0.2s;
}

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

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.actions a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
    display: inline-block;
    background: #f1f5f9;
}

.actions a:hover {
    background: #e2e8f0;
    color: #764ba2;
    transform: translateY(-1px);
}

.actions .danger {
    color: #ef4444;
    background: #fef2f2;
}

.actions .danger:hover {
    background: #fee2e2;
    color: #dc2626;
}

.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: 14px;
    margin-right: 8px;
}

small {
    display: block;
    color: #64748b;
    font-size: 12px;
    margin-top: 8px;
    font-style: normal;
    line-height: 1.5;
}

p {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.6;
}

.initial-state-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr auto;
    gap: 16px;
    align-items: end;
}

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

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

.form-group-inline {
    margin-bottom: 0;
}

.color-config-title {
    margin: 0 0 16px 0;
    color: #475569;
    font-size: 15px;
    font-weight: 700;
}

.reaction-title {
    margin: 0;
    color: #1e293b;
    font-size: 18px;
    font-weight: 700;
}

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

.rules-header h4 {
    margin: 0;
    color: #1a202c;
    font-size: 18px;
    font-weight: 700;
}

.points-input-wrapper {
    max-width: 200px;
}

.condition-item {
    border: 2px solid #e2e8f0;
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: white;
    transition: all 0.2s;
}

.condition-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.condition-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr 1fr;
    gap: 12px;
    align-items: end;
}

.condition-field {
    display: flex;
    flex-direction: column;
}

.condition-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.condition-field select,
.condition-field input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s;
    background: #fafbfc;
}

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

.condition-message {
    margin-top: 12px;
}

.button-spacing {
    margin-top: 16px;
}

.section-spacing {
    margin-bottom: 24px;
}

.collapsible-section {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.collapsible-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.08) 100%);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: all 0.2s;
}

.collapsible-header:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.15) 100%);
}

.collapsible-header h3 {
    margin: 0;
    border: none;
    padding: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.collapsible-header h3::after {
    display: none;
}

.collapsible-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
    color: #667eea;
}

.collapsible-section.active .collapsible-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.collapsible-section.active .collapsible-content {
    max-height: 10000px;
    padding: 24px;
}

.tabs-container {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.tabs-header {
    display: flex;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-bottom: 2px solid #e2e8f0;
    overflow-x: auto;
}

.tab-button {
    padding: 16px 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
}

.tab-button:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.tab-content {
    display: none;
    padding: 24px;
}

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

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

@media (max-width: 768px) {
    .step-header {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .rules-grid {
        grid-template-columns: 1fr;
    }
    
    .initial-state-grid {
        grid-template-columns: 1fr;
    }
    
    .reaction-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .container {
        padding: 20px 16px;
    }
    
    .card {
        padding: 24px;
    }
    
    .basic-info-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs-header {
        flex-wrap: wrap;
    }
    
    .tab-button {
        padding: 12px 16px;
        font-size: 13px;
    }
}

.delete-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.delete-modal-overlay.active {
    display: flex;
}

.delete-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    padding: 0;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.delete-modal-header {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    padding: 24px 32px;
    color: white;
}

.delete-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.delete-modal-header h3::before {
    content: '⚠️';
    font-size: 24px;
}

.delete-modal-body {
    padding: 32px;
}

.delete-modal-message {
    font-size: 16px;
    color: #1e293b;
    line-height: 1.6;
    margin-bottom: 24px;
}

.delete-modal-filename {
    font-weight: 700;
    color: #ef4444;
    word-break: break-all;
}

.delete-modal-warning {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px 16px;
    color: #991b1b;
    font-size: 14px;
    margin-bottom: 24px;
}

.delete-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.delete-modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-modal-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}

.delete-modal-btn-cancel:hover {
    background: #e2e8f0;
}

.delete-modal-btn-confirm {
    background: #ef4444;
    color: white;
}

.delete-modal-btn-confirm:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
