/* OwnMaps - Pastel Pink Theme with Dark Mode */

:root {
    /* Light mode - Pastel Pink */
    --primary-color: #ffb3d9;
    --primary-hover: #ff99cc;
    --primary-dark: #ff80bf;
    --bg-primary: #ffffff;
    --bg-secondary: #fff5fa;
    --bg-tertiary: #ffe6f2;
    --text-primary: #2d2d2d;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #ffe6f2;
    --shadow: rgba(255, 179, 217, 0.15);
    --map-bg: #fff0f7;
}

body.dark-mode {
    /* Dark mode - Pastel Pink accents */
    --primary-color: #ff99cc;
    --primary-hover: #ffb3d9;
    --primary-dark: #ff80bf;
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #4a4a4a;
    --shadow: rgba(0, 0, 0, 0.3);
    --map-bg: #252525;
}

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

body {
    font-family: Roboto, Arial, sans-serif;
    overflow: hidden;
    height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.3s, color 0.3s;
}

/* Top Bar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-primary);
    box-shadow: 0 2px 4px var(--shadow);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 30px;
}

.search-container {
    flex: 1;
    max-width: 600px;
}

.search-box {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 0 20px;
    font-size: 14px;
    outline: none;
    transition: box-shadow 0.2s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-box:focus {
    box-shadow: 0 1px 6px var(--shadow);
    border-color: var(--primary-color);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.user-role {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

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

.role-user {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

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

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

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

.btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-text:hover {
    text-decoration: underline;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

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

.btn-block {
    width: 100%;
    margin-top: 10px;
}

/* Map Container */
.map-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 400px;
    background: var(--bg-primary);
    box-shadow: 2px 0 4px var(--shadow);
    overflow-y: auto;
    position: relative;
    z-index: 100;
    transition: transform 0.3s;
    border-right: 1px solid var(--border-color);
}

.sidebar.collapsed {
    transform: translateX(-400px);
}

.sidebar-toggle {
    position: absolute;
    right: -40px;
    top: 20px;
    width: 40px;
    height: 40px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-left: none;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 2px 4px var(--shadow);
    color: var(--text-primary);
}

.sidebar-content {
    padding: 20px;
}

.panel {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.panel:last-child {
    border-bottom: none;
}

.panel h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.help-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.help-content {
    font-size: 14px;
    line-height: 1.6;
}

.help-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.help-content li {
    margin: 5px 0;
}

.help-content strong {
    color: var(--primary-color);
}

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

.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.input-group textarea {
    height: 80px;
    padding: 8px 12px;
    resize: vertical;
}

.input-group input[type="checkbox"] {
    width: auto;
    height: auto;
}

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

.route-result {
    margin-top: 20px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.route-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.stat {
    flex: 1;
}

.stat-value {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Map Editor */
.editor-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.editor-tab-content {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.editor-form {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.items-list {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.list-item {
    padding: 10px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item-title {
    font-weight: 500;
    color: var(--text-primary);
}

.list-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

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

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

/* Map */
.map {
    flex: 1;
    background: var(--map-bg);
}

.leaflet-container {
    font-family: Roboto, Arial, sans-serif;
    background: var(--map-bg);
}

/* Map Controls */
.map-controls {
    position: absolute;
    bottom: 40px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 500;
}

.control-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    box-shadow: 0 2px 4px var(--shadow);
    cursor: pointer;
    font-size: 20px;
    color: var(--text-primary);
    transition: background 0.2s;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Leaflet Customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 2px 6px var(--shadow);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.leaflet-popup-content {
    margin: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.leaflet-popup-tip {
    background: var(--bg-primary);
}

/* Dark mode adjustments for Leaflet */
body.dark-mode .leaflet-control-attribution {
    background: rgba(26, 26, 26, 0.8);
    color: #e0e0e0;
}

body.dark-mode .leaflet-control-zoom a {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 400px;
    }
    
    .search-container {
        max-width: 300px;
    }
    
    .editor-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1 0 45%;
    }
}

/* Admin Only */
.admin-only {
    display: none;
}

body.admin .admin-only {
    display: block;
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar,
.items-list::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.items-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.sidebar::-webkit-scrollbar-thumb,
.items-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.items-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px var(--shadow);
    border-left: 4px solid var(--primary-color);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 350px;
    font-size: 14px;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left-color: #4caf50;
}

.toast-error {
    border-left-color: #f44336;
}

.toast-warning {
    border-left-color: #ff9800;
}

.toast-info {
    border-left-color: var(--primary-color);
}

/* Mode Indicator */
.mode-indicator {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: var(--bg-secondary);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 16px var(--shadow);
    border: 2px solid var(--primary-color);
    max-width: 500px;
}

.mode-indicator-content {
    text-align: center;
}

.mode-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.mode-instructions {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

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

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: flex-end;
}

.modal-actions button {
    flex: 1;
}

/* Cursor changes for editor modes */
.leaflet-container.crosshair {
    cursor: crosshair !important;
}

/* Help text */
.help-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 12px 0;
    line-height: 1.5;
}
