/* BWT-SVG Visualizer Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    background: linear-gradient(135deg, #4fc3f7 0%, #26a69a 100%);
    color: black;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

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

.input-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

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

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

input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

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

input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9rem;
}

button {
    background: linear-gradient(135deg, #4fc3f7 0%, #26a69a 100%);
    color: black;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.example-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.example-btn {
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #e9ecef;
    padding: 8px 16px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.example-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-1px);
}

.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

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

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

.error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.output-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 30px;
}

.svg-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.svg-container h3 {
    margin-bottom: 15px;
    color: #555;
    font-size: 1.2rem;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e5e9;
}

.svg-display {
    width: 100%;
    overflow: auto;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #fafafa;
    min-height: 200px;
    position: relative;
    cursor: grab;
    user-select: none;
}

.svg-display:active {
    cursor: grabbing;
}

.svg-display svg {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.1s ease;
    transform-origin: center center;
}

/* Zoom and Pan Controls */
.zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 10;
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background-color 0.2s;
}

.zoom-btn:hover {
    background: rgba(240, 240, 240, 0.9);
}

.zoom-btn:active {
    background: rgba(220, 220, 220, 0.9);
}

.zoom-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10;
}

/* SVG Controls */
.svg-controls {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.control-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
}

.control-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* Legend Styles */
.legend {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    font-size: 14px;
    line-height: 1.5;
}

.legend h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
}

.legend-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid #ccc;
    margin-right: 4px;
    vertical-align: middle;
}

/* Responsive legend */
@media (max-width: 768px) {
    .legend-content {
        gap: 8px;
    }
    
    .legend-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .input-section {
        padding: 20px;
    }
    
    .example-buttons {
        flex-direction: column;
    }
    
    .example-btn {
        width: 100%;
    }
}

/* Animation for showing/hiding elements */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* SVG Header and Download Button Styles */
.svg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.download-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.download-btn:hover {
    background: #0056b3;
}

.download-btn:active {
    background: #004085;
}
