/* Add classes to enable scrolling */
.my-maps-page {
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
}

.my-maps-page .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 20px);
    /* Use safe area inset instead of fixed padding-top */
}

.my-maps-page h1 {
    font-family: "Monsieur La Doulaise", system-ui;
    font-size: 4.5rem;
    margin-bottom: 30px;
    text-align: center;
    font-weight: normal;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.my-maps-page .controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

#newMap {
    padding: 12px 20px;
    background-color: #0000ff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#newMap:hover {
    background-color: #0000cc;
}

/* Updated grid layout with more explicit rules */
.my-maps-page .maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
}

/* Add media queries to ensure proper grid behavior */
@media (min-width: 650px) {
    .my-maps-page .maps-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 950px) {
    .my-maps-page .maps-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1250px) {
    .my-maps-page .maps-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.map-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    width: 100%;
    /* Ensure the card takes full width of its grid cell */
}

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

.map-header {
    background-color: #f4f4f4;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-title {
    font-weight: bold;
    font-size: 18px;
    margin: 0;
}

.map-preview {
    height: 150px;
    background-color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #999;
    font-style: italic;
    overflow: hidden;
}

.map-description {
    padding: 15px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    max-height: 80px;
    overflow-y: auto;
}

.map-description p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.map-footer {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edit-button {
    padding: 8px 16px;
    background-color: #0000ff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.edit-button:hover {
    background-color: #0000cc;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 30px;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 8px 0;
    min-width: 150px;
    z-index: 10;
    display: none;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
}

.dropdown-menu button:hover {
    background-color: #f4f4f4;
}

.status-badge {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    background-color: #eee;
}

.status-badge.published {
    background-color: #4CAF50;
    color: white;
}

.status-badge.draft {
    background-color: #FFC107;
    color: black;
}

.status-badge.archived {
    background-color: #9e9e9e;
    color: white;
}

.archived-map {
    opacity: 0.85;
    position: relative;
}

.archived-map::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(45deg,
            rgba(0, 0, 0, 0.05),
            rgba(0, 0, 0, 0.05) 10px,
            rgba(0, 0, 0, 0.08) 10px,
            rgba(0, 0, 0, 0.08) 20px);
    pointer-events: none;
    z-index: 1;
    border-radius: 8px;
}

.restore-button {
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.restore-button:hover {
    background-color: #3e8e41;
}

/* Toggle switch styles */
.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
    background-color: #ccc;
    border-radius: 24px;
    transition: .4s;
    margin-right: 10px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked+.toggle-slider {
    background-color: #0000ff;
}

input:checked+.toggle-slider:before {
    transform: translateX(16px);
}

.toggle-label {
    font-size: 14px;
    color: #666;
}

.created-at {
    font-size: 12px;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #666;
    grid-column: 1 / -1;
    /* Make empty state span all columns */
}

/* Feedback message styles */
#feedbackMessage {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    z-index: 1000;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    animation: fadeInOut 3s ease;
}

#feedbackMessage.success {
    background-color: #4CAF50;
    color: white;
}

#feedbackMessage.error {
    background-color: #f44336;
    color: white;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.version-info {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.tips {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
}

.image-hosting-help {
    margin-top: 15px;
    font-size: 14px;
}

.image-hosting-help summary {
    cursor: pointer;
    color: #0000ff;
    font-weight: 500;
    margin-bottom: 10px;
}

.image-hosting-help summary:hover {
    text-decoration: underline;
}

.help-content {
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-top: 5px;
}

.help-content h4 {
    margin: 10px 0 5px;
    color: #333;
}

.help-content ol {
    margin: 5px 0 15px;
    padding-left: 20px;
}

.help-content a {
    color: #0000ff;
    text-decoration: none;
}

.help-content a:hover {
    text-decoration: underline;
}

.count-badge {
    display: inline-block;
    background-color: #0000ff;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 12px;
    margin-left: 5px;
}

/* Mobile-specific adjustments */
@media screen and (max-width: 768px) {
    body {
        /* Ensure the page is properly scrollable */
        height: auto;
        min-height: 100%;
    }

    .container {
        padding-top: 10px;
        padding-bottom: 30px;
        /* Add space at bottom for better scrolling */
    }

    h1 {
        font-size: 3.5rem;
        /* Slightly smaller title on mobile */
        margin-top: 10px;
        margin-bottom: 20px;
    }

    /* Ensure maps grid fills viewport correctly */
    .maps-grid {
        width: 100%;
        /* Ensure enough space is available for all maps */
        min-height: calc(100vh - 150px);
    }
}