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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-image: url('background.svg'), linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    background-attachment: fixed, fixed;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #ff601f 0%, #cc4d19 100%);
    color: white;
    padding: 20px 30px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

.controls-panel {
    padding: 25px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 500;
    font-size: 14px;
    color: #555;
}

.control-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.control-group input[type="color"]:hover {
    border-color: #ff601f;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ff601f;
    cursor: pointer;
    transition: background 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #e5551c;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ff601f;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    background: #e5551c;
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.control-group select:hover {
    border-color: #ff601f;
}

.control-group select:focus {
    outline: none;
    border-color: #ff601f;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-direction: row;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.control-group span {
    font-weight: 600;
    color: #ff601f;
    font-size: 14px;
}

.button-group {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 96, 31, 0.4);
    background: #e5551c;
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

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

.main-content {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
}

.objects-sidebar {
    width: 250px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: fit-content;
    max-height: 600px;
    overflow-y: auto;
}

.objects-sidebar h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.add-object-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.btn-add-object {
    padding: 10px 15px;
    border: 2px solid #ff601f;
    border-radius: 6px;
    background: white;
    color: #ff601f;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-object:hover {
    background: #ff601f;
    color: white;
}

.objects-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.object-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.object-item.active {
    border-color: #ff601f;
    background: #fff4f0;
}

.object-info {
    flex: 1;
}

.object-type {
    font-weight: 600;
    color: #ff601f;
    font-size: 14px;
    text-transform: capitalize;
}

.object-details {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.btn-edit-object {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: #ff601f;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-edit-object:hover {
    background: #e5551c;
}

.btn-remove-object {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: #dc3545;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-remove-object:hover {
    background: #c82333;
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 20px;
}

#drawingCanvas {
    border: 2px solid #333;
    border-radius: 8px;
    background: #000;
    cursor: crosshair;
    touch-action: none;
}

.instructions {
    padding: 20px 30px;
    text-align: center;
    color: #666;
    font-size: 14px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

/* 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);
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer .btn {
    padding: 10px 20px;
    font-size: 14px;
}

/* Text resize handle */
.text-resize-handle {
    fill: #00ff00;
    stroke: #000;
    stroke-width: 1;
    cursor: nwse-resize;
    opacity: 0.8;
}

.text-resize-handle:hover {
    opacity: 1;
    fill: #00cc00;
}

@media (max-width: 768px) {
    .controls-panel {
        grid-template-columns: 1fr;
    }

    .button-group {
        grid-column: 1;
    }

    .main-content {
        flex-direction: column;
    }

    .objects-sidebar {
        width: 100%;
        max-height: 300px;
    }

    #drawingCanvas {
        width: 100%;
        height: auto;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }
}

footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-top: 30px;
    color: #666;
    font-size: 14px;
}

.footer-left {
    display: flex;
    align-items: center;
}

.footer-right {
    display: flex;
    align-items: center;
}

footer a {
    color: #666;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
}

footer a:hover {
    color: #ff601f;
}

.github-link img {
    height: 20px;
    width: auto;
}

.footer-logo {
    height: 30px;
    width: auto;
    vertical-align: middle;
}

