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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.input-section {
    padding: 30px;
    background: #f8f9fa;
}

.input-section h2 {
    color: #333;
    margin-bottom: 20px;
}

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

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

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #28a745;
    color: white;
    margin-top: 20px;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
    background: #6c757d;
    color: white;
    margin-bottom: 10px;
}

.btn-small:hover {
    background: #5a6268;
}

#transitionTableSection {
    padding: 30px;
    background: white;
}

#transitionTableSection h3 {
    color: #333;
    margin-bottom: 20px;
}

.transition-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.transition-table th,
.transition-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

.transition-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.transition-table input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#loading {
    padding: 50px;
    text-align: center;
}

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

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

#results {
    padding: 30px;
}

#results h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

#results h3 {
    color: #667eea;
    margin: 30px 0 15px 0;
    font-size: 1.5em;
}

.original-dfa,
.equivalence-steps,
.minimized-dfa,
.dot-code {
    margin-bottom: 40px;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.result-table th,
.result-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

.result-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.result-table tr:nth-child(even) {
    background: #f8f9fa;
}

.step-card {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.step-card h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.partition-groups {
    margin-bottom: 15px;
}

.group {
    display: inline-block;
    background: white;
    padding: 8px 15px;
    margin: 5px;
    border-radius: 20px;
    border: 2px solid #667eea;
    color: #667eea;
    font-weight: 600;
}

.analysis {
    margin-top: 20px;
    background: white;
    padding: 15px;
    border-radius: 8px;
}

.analysis-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.9em;
}

.analysis-table th,
.analysis-table td {
    padding: 8px;
    text-align: center;
    border: 1px solid #ddd;
}

.analysis-table th {
    background: #764ba2;
    color: white;
}

.analysis-table tr:nth-child(even) {
    background: #f8f9fa;
}

.state-mapping {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

.state-mapping h4 {
    color: #333;
    margin-bottom: 10px;
}

.state-mapping ul {
    list-style: none;
    padding-left: 0;
}

.state-mapping li {
    padding: 5px 0;
    color: #555;
    font-weight: 500;
}

#dotCode {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.5;
}

.visualize {
    text-align: center;
    padding: 20px;
    background: #e7f3ff;
    border-radius: 8px;
}

.visualize a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
}

.visualize a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .container {
        border-radius: 0;
    }

    .transition-table,
    .result-table,
    .analysis-table {
        font-size: 0.85em;
    }

    .transition-table th,
    .transition-table td,
    .result-table th,
    .result-table td {
        padding: 8px;
    }
}
