/* Reset and Base Styles */
* {
    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;
    color: #333;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

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

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Left Panel */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tool-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #e9ecef;
}

.tool-section h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 8px;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed #6c757d;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: #007bff;
    background-color: #f8f9ff;
}

.upload-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 10px;
    transition: background 0.3s ease;
}

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

.file-upload-area p {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Tool Buttons */
.tool-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tool-btn {
    background: white;
    border: 2px solid #dee2e6;
    padding: 12px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.tool-btn:hover {
    border-color: #007bff;
    background: #f8f9ff;
}

.tool-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.tool-btn .icon {
    font-size: 1.2rem;
}

/* Image Editing Controls */
.editing-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.control-group label {
    font-weight: 500;
    color: #495057;
}

.control-group input[type="range"] {
    width: 100%;
}

.control-group span {
    font-size: 0.9rem;
    color: #6c757d;
    text-align: right;
}

.reset-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

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

/* Hotspot Form */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-buttons {
    display: flex;
    gap: 10px;
}

.save-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    flex: 1;
    transition: background 0.3s ease;
}

.save-btn:hover {
    background: #218838;
}

.cancel-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    flex: 1;
    transition: background 0.3s ease;
}

.cancel-btn:hover {
    background: #c82333;
}

/* Hotspot List */
.hotspot-list {
    max-height: 200px;
    overflow-y: auto;
}

.hotspot-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hotspot-item:hover {
    border-color: #007bff;
    background: #f8f9ff;
}

.hotspot-item.selected {
    border-color: #007bff;
    background: #e3f2fd;
}

.hotspot-item h4 {
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: #495057;
}

.hotspot-item p {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 5px;
}

.hotspot-item .hotspot-link {
    font-size: 0.8rem;
    color: #007bff;
    text-decoration: none;
}

.hotspot-item .hotspot-link:hover {
    text-decoration: underline;
}

.empty-message {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/* Canvas Area */
.canvas-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.canvas-container {
    position: relative;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    overflow: hidden;
    background: #f8f9fa;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mainCanvas {
    max-width: 100%;
    max-height: 100%;
    cursor: crosshair;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 249, 250, 0.9);
    color: #6c757d;
    font-size: 1.2rem;
}

.preview-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.preview-btn,
.export-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.preview-btn {
    background: #17a2b8;
    color: white;
}

.preview-btn:hover {
    background: #138496;
}

.export-btn {
    background: #28a745;
    color: white;
}

.export-btn:hover {
    background: #218838;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

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

.modal-header h3 {
    margin: 0;
    color: #495057;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: #f8f9fa;
}

.modal-body {
    padding: 20px;
}

/* Preview Modal */
.preview-container {
    position: relative;
    max-width: 100%;
    max-height: 70vh;
    overflow: auto;
}

#previewImage {
    max-width: 100%;
    height: auto;
}

.hotspot-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Export Modal */
.export-options {
    margin-bottom: 20px;
}

.export-options h4 {
    margin-bottom: 15px;
    color: #495057;
}

.option-group {
    margin-bottom: 15px;
}

.option-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.option-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    margin-top: 5px;
}

.export-buttons {
    display: flex;
    gap: 10px;
}

.download-btn,
.copy-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.download-btn {
    background: #007bff;
    color: white;
}

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

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

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

/* Tooltip Styles */
.hotspot-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9rem;
    z-index: 100;
    pointer-events: none;
    max-width: 200px;
    word-wrap: break-word;
}

.hotspot-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0,0,0,0.8);
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .tool-buttons {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .preview-controls {
        flex-direction: column;
    }
    
    .export-buttons {
        flex-direction: column;
    }
}

/* Animation for new hotspots */
@keyframes hotspotAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hotspot-item.new {
    animation: hotspotAppear 0.3s ease-out;
}
