/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Custom Properties for Light and Dark Themes */
:root {
    /* Light theme colors (default) */
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #7f8c8d;
    --text-muted: #95a5a6;
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.3);
    --accent-primary: #3498db;
    --accent-secondary: #2980b9;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --header-bg: #2c3e50;
    --header-text: #ffffff;
    --input-bg: #ffffff;
    --modal-bg: #ffffff;
    --notification-bg-success: #27ae60;
    --notification-bg-error: #e74c3c;
    --notification-bg-info: #3498db;
}

/* Dark theme colors */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888888;
    --border-color: #404040;
    --border-light: #505050;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-strong: rgba(0, 0, 0, 0.6);
    --accent-primary: #4a9eff;
    --accent-secondary: #357abd;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #4a9eff;
    --header-bg: #1e2a36;
    --header-text: #e0e0e0;
    --input-bg: #3a3a3a;
    --modal-bg: #2d2d2d;
    --notification-bg-success: #2ecc71;
    --notification-bg-error: #e74c3c;
    --notification-bg-info: #4a9eff;
    --map-bg: #262626;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* App container */
.app-container {
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header"
        "main";
}

/* Header */
.app-header {
    grid-area: header;
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

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

.header-ad {
    flex: 1;
    max-width: 400px;
    height: 36px;
    margin: 0 1.5rem;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--header-text);
    opacity: 0.8;
    transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    cursor: default;
}

.header-ad:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

.header-ad p {
    margin: 0;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    background: none;
    border: 2px solid var(--header-text);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--header-text);
    font-size: 1.2rem;
    padding: 0;
}

.dark-mode-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.dark-mode-toggle:active {
    transform: scale(0.95);
}

.dark-mode-toggle .toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.dark-mode-toggle:hover .toggle-icon {
    transform: rotate(15deg);
}

/* Base transition for common elements */
.app-header,
.sidebar,
.sidebar-footer,
.map-container,
.btn,
.search-input,
.modal-content {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Disable all transitions during resizing for performance */
body.resizing-active * {
    transition: none !important;
}

/* Main content area */
.main-content {
    grid-area: main;
    display: grid;
    grid-template-columns: 300px 4px 1fr;
    grid-template-areas: "sidebar handle map";
    height: 100%;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 350px;
    /* Default width */
    min-width: 250px;
    max-width: 600px;
    transition: width 0.1s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar section {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    transition: border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar section:last-child {
    border-bottom: none;
}

.sidebar section h2 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.75rem 1rem;
    background-color: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.ad-placeholder {
    background-color: var(--border-light);
    border: 1px dashed var(--text-muted);
    border-radius: 4px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.footer-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.btn-link:hover {
    color: var(--accent-secondary);
}

.copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    transition: color 0.3s ease;
}

/* Resize handle */
.resize-handle {
    grid-area: handle;
    background-color: var(--border-color);
    cursor: col-resize;
    transition: background-color 0.2s ease;
    position: relative;
    user-select: none;
    z-index: 10;
}

.resize-handle:hover {
    background-color: var(--accent-primary);
}

.resize-handle.resizing {
    background-color: var(--accent-secondary);
}

.resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 20px;
    background-color: var(--text-muted);
    border-radius: 1px;
    transition: background-color 0.2s ease;
}

.resize-handle:hover::after,
.resize-handle.resizing::after {
    background-color: var(--header-text);
}

/* Visual feedback during resize */
.resizing-active {
    user-select: none;
    -webkit-user-select: none;
}

.resizing-active * {
    pointer-events: none;
}

/* Map container */
.map-container {
    grid-area: map;
    position: relative;
    overflow: hidden;
}

.map {
    width: 100%;
    height: 100%;
    background-color: var(--map-bg);
}

/* Leaflet Dark Mode Filter */
[data-theme="dark"] .leaflet-tile-pane {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

/* Reducre brightness of markers in dark mode to better blend with inverted map if needed, 
   but usually labels and icons look better as is. 
   However, we should ensure the attribution and zoom controls are dark-mode friendly if they aren't. */
[data-theme="dark"] .leaflet-container {
    background: var(--map-bg);
}

[data-theme="dark"] .leaflet-control-attribution {
    background-color: rgba(0, 0, 0, 0.7) !important;
    color: #ccc !important;
}

[data-theme="dark"] .leaflet-control-attribution a {
    color: #4a9eff !important;
}

[data-theme="dark"] .leaflet-bar a {
    background-color: var(--header-bg);
    color: var(--header-text);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .leaflet-bar a:hover {
    background-color: var(--bg-tertiary);
}

/* Add Pin Controls */
.add-pin-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Search Section */
.search-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* Pin List */
.pin-list-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pin-list {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

/* Virtual scrolling structure */
.pin-list-viewport {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.pin-list-spacer-top,
.pin-list-spacer-bottom {
    width: 100%;
}

.pin-list-visible {
    width: 100%;
}

/* Pin list items */
.pin-list-item {
    min-height: 120px;
    /* Increased to match virtual scrolling height */
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Changed from space-between to allow content to flow naturally */
    background-color: var(--bg-secondary);
}

.pin-list-item:hover {
    background-color: var(--bg-tertiary);
}

.pin-list-item.selected {
    background-color: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
}

.pin-list-item:last-child {
    border-bottom: none;
}

.pin-item-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex: 1;
}

.pin-appearance-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    margin-top: 2px;
}

.pin-item-content {
    flex: 1;
    min-width: 0;
}

.pin-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    transition: color 0.3s ease;
}

.pin-notes-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    overflow: hidden;
    max-height: 12em;
    position: relative;
    white-space: normal;
    word-wrap: break-word;
    transition: color 0.3s ease;
}

/* Style markdown elements within the notes preview */
.pin-notes-preview p {
    margin: 0.2rem 0;
    font-style: normal;
    line-height: 1.3;
}

.pin-notes-preview p:first-child {
    margin-top: 0;
}

.pin-notes-preview p:last-child {
    margin-bottom: 0;
}

.pin-notes-preview br {
    line-height: 1.3;
}

.pin-notes-preview h1,
.pin-notes-preview h2,
.pin-notes-preview h3,
.pin-notes-preview h4,
.pin-notes-preview h5,
.pin-notes-preview h6 {
    margin: 0.3rem 0 0.1rem 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #7f8c8d;
    font-style: normal;
    line-height: 1.2;
}

.pin-notes-preview strong {
    font-weight: 600;
    color: #7f8c8d;
    font-style: normal;
}

.pin-notes-preview em {
    font-style: italic;
}

.pin-notes-preview code {
    background-color: #f8f9fa;
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
    font-size: 0.7rem;
    font-family: 'Courier New', monospace;
    font-style: normal;
}

.pin-notes-preview ul,
.pin-notes-preview ol {
    margin: 0.25rem 0;
    padding-left: 1rem;
    font-style: normal;
}

.pin-notes-preview li {
    margin: 0.1rem 0;
}

.pin-notes-preview blockquote {
    border-left: 2px solid #bdc3c7;
    padding-left: 0.5rem;
    margin: 0.25rem 0;
    font-style: italic;
    color: #95a5a6;
}

.pin-notes-preview a {
    color: #3498db;
    text-decoration: none;
}

.pin-notes-preview a:hover {
    text-decoration: underline;
}

.pin-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    /* Fixed margin instead of auto for better spacing */
    flex-shrink: 0;
}

.btn-center {
    background-color: #3498db;
    color: white;
}

.btn-center:hover {
    background-color: #2980b9;
}

/* Import/Export Controls */
.import-export-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.import-export-grid .btn {
    width: 100%;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

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

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

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

.btn-danger {
    background-color: var(--error-color);
    color: var(--header-text);
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-edit {
    background-color: var(--warning-color);
    color: var(--header-text);
}

.btn-edit:hover {
    background-color: #e67e22;
}

.btn-delete {
    background-color: var(--error-color);
    color: var(--header-text);
}

.btn-delete:hover {
    background-color: #c0392b;
}

.btn-center {
    background-color: var(--accent-primary);
    color: var(--header-text);
}

.btn-center:hover {
    background-color: var(--accent-secondary);
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 300px 4px 1fr;
    }

    .sidebar {
        min-width: 250px;
        max-width: 60vw;
    }

    .app-header {
        padding: 0.75rem 1rem;
    }

    .app-header h1 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        grid-template-columns: 250px 4px 1fr;
    }

    .sidebar {
        min-width: 200px;
        max-width: 70vw;
    }

    .sidebar section {
        padding: 0.75rem;
    }

    .sidebar h2 {
        font-size: 0.9rem;
    }
}

/* Scrollbar styling */
.pin-list::-webkit-scrollbar {
    width: 6px;
}

.pin-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.pin-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.pin-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading and notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem;
    border-radius: 4px;
    color: var(--header-text);
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

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

.notification.success {
    background-color: var(--notification-bg-success);
}

.notification.error {
    background-color: var(--notification-bg-error);
}

.notification.info {
    background-color: var(--notification-bg-info);
}

/* Custom pin marker styles */
.custom-pin-marker {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.custom-pin-marker svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

.custom-pin-marker:hover svg {
    transform: scale(1.1);
}

/* Pin popup styles */
.pin-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pin-popup .leaflet-popup-content {
    margin: 0;
    padding: 0;
}

.pin-popup-content {
    padding: 1rem;
}

.pin-popup-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.pin-popup-coordinates {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin: 0 0 0.75rem 0;
    font-family: 'Courier New', monospace;
}

.pin-popup-notes {
    margin: 0.75rem 0;
    font-size: 0.9rem;
    line-height: 1.5;
    max-height: 150px;
    overflow-y: auto;
}

.pin-popup-notes h1,
.pin-popup-notes h2,
.pin-popup-notes h3,
.pin-popup-notes h4,
.pin-popup-notes h5,
.pin-popup-notes h6 {
    margin: 0.5rem 0 0.25rem 0;
    color: #2c3e50;
}

.pin-popup-notes p {
    margin: 0.5rem 0;
}

.pin-popup-notes ul,
.pin-popup-notes ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.pin-popup-notes li {
    margin: 0.25rem 0;
}

.pin-popup-notes code {
    background-color: #f8f9fa;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.pin-popup-notes pre {
    background-color: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.8rem;
}

.pin-popup-notes blockquote {
    border-left: 3px solid #3498db;
    padding-left: 0.75rem;
    margin: 0.5rem 0;
    color: #7f8c8d;
    font-style: italic;
}

.pin-popup-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e0e0e0;
}

/* Popup scrollbar styling */
.pin-popup-notes::-webkit-scrollbar {
    width: 4px;
}

.pin-popup-notes::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.pin-popup-notes::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.pin-popup-notes::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--modal-bg);
    border-radius: 8px;
    box-shadow: 0 8px 32px var(--shadow-strong);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-tertiary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

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

.modal-close:hover {
    background-color: var(--error-color);
    color: var(--header-text);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    background-color: var(--modal-bg);
    transition: background-color 0.3s ease;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background-color: var(--bg-tertiary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Form Styles */
.form-section {
    margin-bottom: 2rem;
}

.form-section:last-child {
    margin-bottom: 1rem;
}

.form-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: 0.5rem;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-group input.error,
.form-group textarea.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}

.form-group input[type="text"]::placeholder,
.form-group input[type="number"]::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    transition: color 0.3s ease;
}

/* Appearance Options */
.appearance-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.appearance-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.75rem;
    border: 2px solid transparent;
    border-radius: 6px;
    transition: all 0.2s ease;
    min-width: 80px;
}

.appearance-option:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

.appearance-option input[type="radio"] {
    display: none;
}

.appearance-option input[type="radio"]:checked+.appearance-preview {
    transform: scale(1.2);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.appearance-option input[type="radio"]:checked~.appearance-label {
    color: var(--accent-primary);
    font-weight: 600;
}

.appearance-preview {
    display: inline-block;
    transition: all 0.2s ease;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Size Previews */
.size-small {
    width: 16px;
    height: 16px;
    background-color: #3498db;
    border-radius: 50%;
}

.size-medium {
    width: 24px;
    height: 24px;
    background-color: #3498db;
    border-radius: 50%;
}

.size-large {
    width: 32px;
    height: 32px;
    background-color: #3498db;
    border-radius: 50%;
}

/* Shape Previews */
.appearance-preview.shape-circle {
    background-color: #3498db;
    border-radius: 50%;
    width: 24px;
    height: 24px;
}

.appearance-preview.shape-square {
    background-color: #3498db;
    border-radius: 2px;
    width: 24px;
    height: 24px;
}

.appearance-preview.shape-triangle {
    width: 0 !important;
    height: 0 !important;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 24px solid #3498db;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border-top: none;
    border-width: 0 12px 24px 12px;
    border-style: solid;
    border-color: transparent transparent #3498db transparent;
}

/* Color Previews */
.appearance-preview.color-red {
    background-color: #e74c3c;
    border-radius: 50%;
    width: 24px;
    height: 24px;
}

.appearance-preview.color-blue {
    background-color: #3498db;
    border-radius: 50%;
    width: 24px;
    height: 24px;
}

.appearance-preview.color-green {
    background-color: #27ae60;
    border-radius: 50%;
    width: 24px;
    height: 24px;
}

.appearance-preview.color-yellow {
    background-color: #f1c40f;
    border-radius: 50%;
    width: 24px;
    height: 24px;
}

.appearance-preview.color-purple {
    background-color: #9b59b6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
}

.appearance-label {
    font-size: 0.8rem;
    color: #2c3e50;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
}

/* Form Errors */
.form-errors {
    background-color: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 1rem;
    display: none;
}

.form-errors.show {
    display: block;
}

.form-errors ul {
    margin: 0;
    padding-left: 1.25rem;
    color: #721c24;
}

.form-errors li {
    margin-bottom: 0.25rem;
}

/* Modal Body Enhancements */
.privacy-notice,
.backup-warning {
    padding: 1rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.privacy-notice {
    background-color: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.backup-warning {
    background-color: rgba(243, 156, 18, 0.1);
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.privacy-notice h3,
.backup-warning h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2rem;
}

/* Modal Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .appearance-options {
        gap: 0.5rem;
    }

    .appearance-option {
        min-width: 60px;
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        max-height: 98vh;
    }

    .appearance-options {
        justify-content: center;
    }
}