/* MapMarker Tool Styles */

:root {
    --primary-color: #4A90E2;
    --secondary-color: #7B68EE;
    --success-color: #7ED321;
    --danger-color: #D0021B;
    --dark-bg: #1a1a2e;
    --light-bg: #f5f5f5;
    --sidebar-width: 350px;
    --header-height: 60px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-bg);
    color: #333;
    line-height: 1.6;
}

/* Header */
.header {
    background: var(--dark-bg);
    color: white;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #357ABD;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Container */
.container {
    margin-top: var(--header-height);
    padding: 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Auth Forms */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height));
    padding: 2rem;
}

.auth-box {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-box h2 {
    margin-bottom: 1.5rem;
    color: var(--dark-bg);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group select option {
    padding: 0.5rem;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.error-message {
    background: #ffe6e6;
    color: var(--danger-color);
    padding: 0.75rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--danger-color);
}

.success-message {
    background: #e6ffe6;
    color: #2d8c2d;
    padding: 0.75rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--success-color);
}

/* Map Editor Layout */
.editor-container {
    display: flex;
    height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
}

.editor-sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    padding: 1.5rem;
}

.editor-canvas {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    flex-direction: column;
}

/* Map Canvas */
.map-container {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
    min-height: 0; /* Important for flex containers */
}

.map-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-viewport:active {
    cursor: grabbing;
}

.map-image-wrapper {
    position: relative;
    display: inline-block;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

.map-image {
    display: block;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    user-select: none;
}

.map-markers-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Markers */
.marker {
    position: absolute;
    width: 48px;
    height: 48px;
    cursor: pointer;
    pointer-events: all;
    transform: translate(-50%, -100%);
    transition: transform 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    user-select: none;
}

.draggable-marker {
    cursor: move;
}

.marker.dragging {
    z-index: 1000;
    transform: translate(-50%, -100%) scale(1.3);
    transition: none;
}

.marker:hover {
    transform: translate(-50%, -100%) scale(1.2);
}

.marker.active {
    transform: translate(-50%, -100%) scale(1.3);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

.marker svg {
    width: 100%;
    height: 100%;
}

/* Marker Panel */
.marker-panel {
    position: fixed;
    right: 0;
    top: var(--header-height);
    width: 400px;
    height: calc(100vh - var(--header-height));
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 999;
}

.marker-panel.open {
    transform: translateX(0);
}

.marker-panel-header {
    padding: 1.5rem;
    background: var(--dark-bg);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.marker-panel-content {
    padding: 1.5rem;
}

.marker-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Marker Media */
.marker-media {
    margin-top: 1.5rem;
}

.marker-media h3 {
    margin-bottom: 1rem;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-item-remove {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.media-item:hover .media-item-remove {
    opacity: 1;
}

/* Maps Grid */
.maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.map-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.map-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.map-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.map-card-content {
    padding: 1.5rem;
}

.map-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-bg);
}

.map-card-description {
    color: #666;
    margin-bottom: 1rem;
}

.map-card-actions {
    display: flex;
    gap: 0.5rem;
}

.map-card-actions .btn {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.85rem;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
    flex-shrink: 0; /* Don't shrink the toolbar */
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Marker Type Selector */
.marker-types {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.marker-type-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.marker-type-btn:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.marker-type-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.marker-type-btn svg {
    width: 24px;
    height: 24px;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

/* Embed Code */
.embed-code {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 5px;
    font-family: monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
    margin-top: 1rem;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .editor-sidebar {
        position: fixed;
        left: -100%;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        z-index: 998;
        transition: left 0.3s ease;
    }
    
    .editor-sidebar.open {
        left: 0;
    }
    
    .marker-panel {
        width: 100%;
    }
    
    .maps-grid {
        grid-template-columns: 1fr;
    }
}

/* Rich Text Editor Styling */
.marker-description-content {
    font-family: inherit;
}

.marker-description-content h1,
.marker-description-content h2,
.marker-description-content h3 {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.marker-description-content h1 {
    font-size: 1.5rem;
}

.marker-description-content h2 {
    font-size: 1.25rem;
}

.marker-description-content h3 {
    font-size: 1.1rem;
}

.marker-description-content p {
    margin-bottom: 0.5rem;
}

.marker-description-content ul,
.marker-description-content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.marker-description-content strong {
    font-weight: 600;
}

.marker-description-content em {
    font-style: italic;
}

.marker-description-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.marker-description-content a:hover {
    color: #357ABD;
}

/* Quill Editor Custom Styles */
.ql-toolbar {
    border-radius: 5px 5px 0 0;
    background: #f8f9fa;
}

.ql-container {
    border-radius: 0 0 5px 5px;
    font-size: 1rem;
}

.ql-editor {
    min-height: 150px;
}

.ql-editor.ql-blank::before {
    font-style: normal;
    color: #999;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

