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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fafafa;
    min-height: 100vh;
    color: #202124;
    margin: 0;
    padding: 0;
    display: flex;
}

/* Chat Agent Styles */
.chat-agent {
    width: 350px;
    height: 100vh;
    background: white;
    border-right: 1px solid #dadce0;
    display: none; /* Hidden by default */
    flex-direction: column;
    box-shadow: none;
    z-index: 1000;
}

.chat-agent.visible {
    display: flex; /* Show when visible class is added */
}

.chat-header {
    background: white;
    color: #202124;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dadce0;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}


.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: white;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.user .message-content {
    background: #1a73e8;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: #f1f3f4;
    color: #202124;
    border: none;
    border-bottom-left-radius: 4px;
    box-shadow: none;
}

.chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #dadce0;
    display: flex;
    gap: 10px;
}

#chatInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 24px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
    background: white;
}

#chatInput:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 1px #1a73e8;
}

.send-btn {
    background: #1a73e8;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 60px;
}

.send-btn:hover {
    background: #1557b0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.send-btn:active {
    background: #0d47a1;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    overflow-y: auto;
    height: 100vh;
}

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


.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    background: white;
    border: 2px dashed #dadce0;
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.upload-area:hover {
    border-color: #1a73e8;
    background: #f8f9fa;
}

.upload-area.dragover {
    border-color: #1a73e8;
    background: #e8f0fe;
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: #5f6368;
    margin-bottom: 20px;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #202124;
    font-weight: 400;
}

.upload-content p {
    color: #5f6368;
    font-size: 1rem;
    font-weight: 400;
}

.results-section {
    background: transparent;
    border-radius: 0;
    padding: 0;
    border: none;
    margin-bottom: 20px;
}

.preview-section h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: #202124;
    font-weight: 400;
    border-bottom: 1px solid #dadce0;
    padding-bottom: 8px;
}

/* SVG Elements Info */
.svg-elements-info {
    background: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

/* Color Picker Panel */
.color-picker-panel {
    background: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}


.color-properties {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.color-property {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.color-property label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
    min-width: 60px;
}

.color-input-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.color-picker {
    width: 35px;
    height: 30px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    cursor: pointer;
    background: none;
    padding: 0;
    transition: border-color 0.2s ease;
}

.color-picker:hover {
    border-color: #1a73e8;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 4px;
    overflow: hidden;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-text {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
    transition: border-color 0.2s ease;
}

.color-text:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 1px #1a73e8;
}

.stroke-width-slider {
    width: 60px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    margin-right: 8px;
}

.stroke-width-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.stroke-width-slider::-webkit-slider-thumb:hover {
    background: #1557b0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.stroke-width-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.stroke-width-value {
    font-size: 0.8rem;
    font-weight: 500;
    color: #1a73e8;
    min-width: 30px;
    text-align: center;
}


.svg-elements-info h4 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #333;
    font-weight: 600;
}

.elements-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.element-tag {
    background: #e8f0fe;
    color: #1a73e8;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid #dadce0;
    transition: all 0.2s ease;
}

.element-tag:hover {
    background: #d2e3fc;
    border-color: #1a73e8;
}

.element-tag.selected {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

.element-tag {
    cursor: pointer;
    user-select: none;
}

/* Animation Controls */
.animation-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dadce0;
    align-items: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
    user-select: none;
}

.control-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #1a73e8;
}

.toggle-text {
    font-weight: 500;
}

.refresh-btn {
    background: #34a853;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn:hover {
    background: #2d8f47;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.refresh-btn:active {
    background: #26803f;
}

.refresh-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Hide refresh button by default since loop is enabled by default */
#refreshAnimation {
    display: none;
}

/* Timer Controls */
.timer-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.timer-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.timer-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.timer-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.timer-slider::-webkit-slider-thumb:hover {
    background: #1557b0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.timer-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.timer-slider::-moz-range-thumb:hover {
    background: #1557b0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.timer-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a73e8;
    min-width: 35px;
    text-align: center;
}

.timer-btn {
    background: #ea4335;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timer-btn:hover {
    background: #d33b2c;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.timer-btn:active {
    background: #b52d20;
}

.timer-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.preview-section {
    margin-bottom: 30px;
}

.preview-container {
    border: none;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
}


.preview-content {
    position: relative;
    height: 70vh;
    width: 100%;
    overflow: hidden;
}

.preview-pane {
    display: flex;
    padding: 0;
    height: 100%;
    background: transparent;
    justify-content: center;
    align-items: center;
    width: 100%;
    overflow: hidden;
}


.preview-pane svg {
    max-width: 100%;
    max-height: 100%;
    border: none;
    border-radius: 0;
    background: transparent;
}

/* SVG Element Highlighting */
.preview-pane svg * {
    transition: all 0.3s ease;
}

.preview-pane svg .highlighted {
    stroke: #ff6b6b !important;
    stroke-width: 3px !important;
    filter: drop-shadow(0 0 8px rgba(255, 107, 107, 0.6));
    animation: highlightPulse 1.5s ease-in-out infinite;
}

@keyframes highlightPulse {
    0%, 100% { 
        stroke-width: 3px;
        filter: drop-shadow(0 0 8px rgba(255, 107, 107, 0.6));
    }
    50% { 
        stroke-width: 4px;
        filter: drop-shadow(0 0 12px rgba(255, 107, 107, 0.8));
    }
}

.download-section {
    text-align: center;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.undo-btn {
    background: #ea4335;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.undo-btn:hover {
    background: #d33b2c;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.undo-btn:active {
    background: #b52d20;
}

.undo-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.download-btn {
    background: #1a73e8;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background: #1557b0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.download-btn:active {
    background: #0d47a1;
}

.clear-btn {
    background: #5f6368;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #4e5256;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.clear-btn:active {
    background: #3c4043;
}

.error-section {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.error-message h3 {
    color: #721c24;
    margin-bottom: 10px;
}

.error-message p {
    color: #721c24;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f1f3f4;
    border-top: 3px solid #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Animation Keyframes */
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

@keyframes scale {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes slide {
    0% { transform: translateX(-100px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    .chat-agent {
        width: 100%;
        height: 50vh;
        border-right: none;
        border-bottom: 1px solid #dadce0;
        order: 2;
    }
    
    .chat-agent.visible {
        display: flex;
    }
    
    .main-content {
        height: 50vh;
        order: 1;
    }
    
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
    
    .results-section {
        padding: 20px;
    }
    
    
    .animation-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .control-group {
        justify-content: center;
    }
    
    .refresh-btn {
        width: 100%;
        justify-content: center;
    }
    
    .color-picker-panel {
        padding: 12px;
    }
    
    .color-properties {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .color-property {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .color-input-group {
        flex-direction: row;
        gap: 6px;
    }
    
    .color-picker {
        width: 40px;
        height: 35px;
    }
    
    .color-text {
        width: 80px;
    }
    
}
