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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: white;
    color: #333;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    z-index: 1000;
    position: relative;
    border-top: 4px solid transparent;
    border-image: linear-gradient(90deg, #f1c40f 0%, #3498db 25%, #e74c3c 50%, #2ecc71 75%, #f1c40f 100%);
    border-image-slice: 1;
}

/* Decorative pegs */
.decorative-pegs-left,
.decorative-pegs-right,
.decorative-pegs-bottom-left,
.decorative-pegs-bottom-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.peg {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
}

.peg-gap {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.peg-yellow {
    background: #f1c40f;
}

.peg-blue {
    background: #3498db;
}

.peg-red {
    background: #e74c3c;
}

.peg-green {
    background: #2ecc71;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    position: relative;
    gap: 1rem;
}

.header-top h1 {
    flex: 1;
}

.header-bottom {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.header-bottom-left,
.header-bottom-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-bottom-left {
    justify-self: start;
}

.header-bottom-right {
    justify-self: end;
}

.header-bottom #addBtn {
    justify-self: center;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
}

.counter {
    font-size: 0.95rem;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    color: #555;
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

#participantCount {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3498db, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.language-selector {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.language-selector:hover {
    border-color: #3498db;
}

.language-selector:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Map */
#map {
    flex: 1;
    width: 100%;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.btn-admin {
    background: transparent;
    color: transparent;
    border: none;
    padding: 0.5rem;
    width: 40px;
    cursor: pointer;
}

.btn-admin:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-size: 1.5rem;
}

/* Form */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-group textarea {
    resize: vertical;
}

/* Color Picker */
.color-picker-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.form-group input[type="color"] {
    width: 80px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
}

.form-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.form-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

/* Suggestions */
.suggestions {
    position: relative;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.suggestions:not(:empty) {
    display: block;
}

.suggestion-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

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

.suggestion-item:hover {
    background-color: #f8f9fa;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.form-actions .btn {
    flex: 1;
    min-width: 100px;
}

/* Success Message */
.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.success-message p {
    margin-bottom: 0.75rem;
}

.success-message p:last-of-type {
    margin-bottom: 1rem;
}

.edit-link-container {
    display: flex;
    gap: 0.5rem;
}

.edit-link-container input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
}

/* Popup */
.popup-content h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-size: 1.1rem;
}

.popup-content p {
    margin-bottom: 0.5rem;
    color: #555;
    line-height: 1.5;
}

.popup-content small {
    color: #7f8c8d;
    font-size: 0.85rem;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .decorative-pegs-bottom-left,
    .decorative-pegs-bottom-right {
        display: none;
    }
}

@media (max-width: 768px) {
    .peg {
        width: 22px;
        height: 22px;
    }

    .peg-gap {
        width: 22px;
        height: 22px;
    }

    .decorative-pegs-left,
    .decorative-pegs-right {
        gap: 0.35rem;
    }

    header h1 {
        font-size: 1.3rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .modal-content {
        margin: 10% auto;
        padding: 1.5rem;
        width: 95%;
    }

    .modal-content h2 {
        font-size: 1.3rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .decorative-pegs-left,
    .decorative-pegs-right {
        display: none;
    }

    .header-top {
        gap: 0.5rem;
    }

    .header-bottom {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .header-bottom-left,
    .header-bottom-right {
        justify-self: stretch;
    }

    .header-bottom-left {
        justify-content: center;
    }

    .header-bottom-right {
        justify-content: center;
    }

    .header-bottom #addBtn {
        justify-self: stretch;
    }

    .counter {
        justify-content: center;
    }

    header h1 {
        font-size: 1.1rem;
    }

    .modal-content {
        margin: 5% auto;
        padding: 1rem;
    }

    .edit-link-container {
        flex-direction: column;
    }

    .edit-link-container input {
        width: 100%;
    }

    .admin-pin-item {
        flex-direction: column;
    }

    .admin-pin-actions {
        width: 100%;
        flex-direction: row;
    }

    .admin-pin-actions button {
        flex: 1;
    }
}

/* Admin Panel */
.admin-modal-content {
    max-width: 700px;
}

.admin-login {
    padding: 1rem 0;
}

.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-container input {
    flex: 1;
    padding-right: 3rem;
}

.btn-toggle-password {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7f8c8d;
    transition: color 0.2s;
}

.btn-toggle-password:hover {
    color: #2c3e50;
}

.eye-icon {
    width: 20px;
    height: 20px;
}

.admin-panel {
    padding: 1rem 0;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 250px;
}

.admin-search-input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.admin-search-input:focus {
    outline: none;
    border-color: #3498db;
}

.admin-count {
    font-size: 0.9rem;
    color: #7f8c8d;
    white-space: nowrap;
}

.admin-pin-list {
    max-height: 500px;
    overflow-y: auto;
}

.admin-pin-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.admin-pin-info {
    flex: 1;
}

.admin-pin-info strong {
    display: block;
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.admin-pin-info p {
    color: #555;
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

.admin-about {
    color: #777;
    font-style: italic;
}

.admin-pin-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.no-pins {
    text-align: center;
    color: #7f8c8d;
    padding: 2rem;
}

/* RTL Support */
body[dir="rtl"] {
    direction: rtl;
}

body[dir="rtl"] .header-top,
body[dir="rtl"] .header-bottom,
body[dir="rtl"] .form-actions,
body[dir="rtl"] .edit-link-container {
    flex-direction: row-reverse;
}

/* Leaflet popup adjustments */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 1rem;
    min-width: 200px;
}

.leaflet-popup-content .btn {
    display: block;
    width: 100%;
    text-align: center;
}
