/* ============================================
   TRAVEL MAP - STYLES
   ============================================ */

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-visited: #10b981;
    --color-visited-light: rgba(16, 185, 129, 0.3);
    --color-planned: #f59e0b;
    --color-planned-light: rgba(245, 158, 11, 0.3);
    --color-neutral: #64748b;
    --color-bg: #f8fafc;
    --color-card: #ffffff;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

/* ============================================
   HEADER
   ============================================ */

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1000;
}

.main-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-stats {
    display: flex;
    gap: 1.5rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.visited { background: var(--color-visited); }
.dot.planned { background: var(--color-planned); }

.btn-admin, .btn-back {
    padding: 0.5rem 1rem;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background 0.2s;
}

.btn-admin:hover, .btn-back:hover {
    background: var(--color-primary-dark);
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-left: 1rem;
}

.btn-logout:hover {
    background: var(--color-bg);
}

/* ============================================
   MAP
   ============================================ */

#map {
    height: calc(100vh - 70px);
    width: 100%;
}

.leaflet-container {
    font-family: inherit;
}

/* Länder-Styles */
.country-default {
    fill: #cbd5e1;
    stroke: #94a3b8;
    stroke-width: 0.5;
    fill-opacity: 0.8;
    transition: fill 0.3s, fill-opacity 0.3s;
}

.country-visited {
    fill: var(--color-visited);
    fill-opacity: 0.7;
}

.country-planned {
    fill: var(--color-planned);
    fill-opacity: 0.7;
}

.country-hover {
    fill-opacity: 1;
    stroke-width: 2;
}

/* Hauptstadt-Marker */
.capital-marker {
    background: none;
    border: none;
}

.capital-icon {
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ============================================
   LEGENDE
   ============================================ */

.map-legend {
    position: fixed;
    bottom: 30px;
    left: 20px;
    background: var(--color-card);
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.map-legend h4 {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.legend-color.visited { background: var(--color-visited); }
.legend-color.planned { background: var(--color-planned); }

.legend-marker {
    font-size: 14px;
}

/* ============================================
   ZOOM HINT
   ============================================ */

.zoom-hint {
    position: fixed;
    bottom: 30px;
    right: 20px;
    background: var(--color-card);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s;
}

.zoom-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   COUNTRY POPUP
   ============================================ */

.country-popup {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 350px;
    max-height: calc(100vh - 140px);
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    z-index: 1001;
    overflow-y: auto;
    transition: transform 0.3s, opacity 0.3s;
}

.country-popup.hidden {
    transform: translateX(400px);
    opacity: 0;
    pointer-events: none;
}

.popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-light);
    cursor: pointer;
}

.popup-title {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    padding-right: 2rem;
}

.popup-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.popup-status.visited {
    background: var(--color-visited-light);
    color: var(--color-visited);
}

.popup-status.planned {
    background: var(--color-planned-light);
    color: var(--color-planned);
}

.popup-date {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.popup-notes {
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    white-space: pre-line;
}

.popup-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.popup-gallery img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s;
}

.popup-gallery img:hover {
    transform: scale(1.05);
}

/* ============================================
   LIGHTBOX
   ============================================ */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: zoom-out;
}

.lightbox.hidden {
    display: none;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

/* ============================================
   ADMIN PAGE
   ============================================ */

.admin-page {
    min-height: 100vh;
}

.admin-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Login Box */
.login-box {
    max-width: 400px;
    margin: 4rem auto;
    background: var(--color-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.alert.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert.success {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--color-bg);
}

/* Admin Grid */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.admin-card {
    background: var(--color-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.admin-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-box {
    text-align: center;
    padding: 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* Filter */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

/* Countries List */
.countries-list {
    background: var(--color-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.countries-list h3 {
    margin-bottom: 1.5rem;
}

.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.country-card {
    background: var(--color-bg);
    padding: 1rem;
    border-radius: var(--radius-md);
    transition: transform 0.2s, box-shadow 0.2s;
}

.country-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.country-card.hidden {
    display: none;
}

.country-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.country-flag {
    font-size: 1.5rem;
}

.country-header h4 {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.status-badge.visited {
    background: var(--color-visited-light);
    color: var(--color-visited);
}

.status-badge.planned {
    background: var(--color-planned-light);
    color: var(--color-planned);
}

.country-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-edit {
    flex: 1;
    padding: 0.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
}

.photo-badge {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* Password Card */
.password-card {
    max-width: 400px;
}

/* ============================================
   MODAL
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-light);
    cursor: pointer;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    padding-right: 2rem;
}

/* Status Options */
.status-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.radio-option {
    flex: 1;
    min-width: 120px;
}

.radio-option input {
    display: none;
}

.radio-option span {
    display: block;
    padding: 0.75rem 1rem;
    text-align: center;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option input:checked + span {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-primary);
}

/* Photo Management */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.upload-area {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.05);
}

.upload-area input {
    display: none;
}

.upload-area p {
    margin-bottom: 0.5rem;
    color: var(--color-text-light);
}

.upload-area small {
    color: var(--color-text-light);
    font-size: 0.8rem;
}

.progress-bar {
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    width: 0;
    transition: width 0.3s;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.form-actions .btn-primary {
    width: auto;
}

/* ============================================
   LEAFLET CUSTOM
   ============================================ */

.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
    margin: 12px 16px;
    font-size: 14px;
}

.capital-popup {
    text-align: center;
}

.capital-popup strong {
    font-size: 1.1em;
}

.capital-popup small {
    display: block;
    color: var(--color-text-light);
    margin-top: 4px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .main-header {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 1rem;
    }
    
    .main-header h1 {
        font-size: 1.2rem;
    }
    
    .header-stats {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    
    #map {
        height: calc(100vh - 110px);
    }
    
    .country-popup {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 60vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        transform: translateY(0);
    }
    
    .country-popup.hidden {
        transform: translateY(100%);
    }
    
    .map-legend {
        bottom: 20px;
        left: 10px;
        padding: 0.75rem;
    }
    
    .zoom-hint {
        bottom: 20px;
        right: 10px;
        left: 140px;
        font-size: 0.75rem;
    }
    
    .admin-main {
        padding: 1rem;
    }
    
    .countries-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
