/* WorldNav Admin Styles */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #252540;
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #3a3a5a;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav a:hover,
.nav a.active {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

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

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

.btn-success:hover {
    background: #059669;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* World Grid */
.world-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.world-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.world-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px var(--shadow);
}

.world-preview {
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--bg-secondary);
}

.world-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.world-info {
    padding: 16px;
}

.world-info h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.world-info .meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    gap: 16px;
}

.world-actions {
    padding: 0 16px 16px;
    display: flex;
    gap: 10px;
}

.world-actions .btn {
    flex: 1;
    justify-content: center;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 2px dashed var(--border);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Loading & Error */
.loading,
.error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
}

/* Forms */
.form-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 30px;
    border: 1px solid var(--border);
    max-width: 600px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="file"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.file-preview {
    margin-top: 10px;
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    display: none;
}

.file-preview.visible {
    display: block;
}

/* Editor Layout */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
}

.editor-canvas-wrapper {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.editor-canvas-container {
    position: relative;
    overflow: auto;
    max-height: calc(100vh - 250px);
}

.editor-canvas {
    position: relative;
    display: inline-block;
}

.editor-canvas img {
    display: block;
    max-width: 100%;
    height: auto;
}

.editor-canvas canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.editor-canvas.marking canvas {
    pointer-events: auto;
    cursor: crosshair;
}

.editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}

.sidebar-section h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

/* Location List */
.location-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.location-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.location-item:hover {
    border-color: var(--accent);
}

.location-item.active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.location-item .name {
    font-weight: 600;
}

.location-item .coords {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.location-item .actions {
    display: flex;
    gap: 5px;
}

.location-item .actions button {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* Marking Status */
.marking-status {
    padding: 12px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    border: 1px solid var(--accent);
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.marking-status .step {
    color: var(--accent);
    font-weight: 600;
}

/* Toast Messages */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 30px;
    width: 400px;
    max-width: 90vw;
    border: 1px solid var(--border);
    transform: scale(0.9);
    transition: transform 0.2s;
}

.modal-overlay.visible .modal {
    transform: scale(1);
}

.modal h3 {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
    justify-content: center;
}

/* Rectangle overlay colors */
.rect-pending {
    stroke: var(--warning);
    stroke-width: 2;
    fill: rgba(245, 158, 11, 0.2);
    stroke-dasharray: 5, 5;
}

.rect-saved {
    stroke: var(--success);
    stroke-width: 2;
    fill: rgba(16, 185, 129, 0.15);
}