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

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --danger: #DC2626;
    --danger-hover: #B91C1C;
    --success: #10B981;
    --text: #1F2937;
    --text-light: #6B7280;
    --bg: #F9FAFB;
    --white: #FFFFFF;
    --border: #E5E7EB;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

/* Forms */
.create-form {
    background: var(--white);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

/* Duration buttons */
.duration-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.duration-btn {
    padding: 0.875rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: var(--white);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.duration-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.duration-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--white);
}

/* Buttons */
.primary-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--primary);
    color: var(--white);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    text-align: center;
}

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

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

.primary-btn.small {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    width: auto;
}

.secondary-btn {
    display: block;
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--primary);
    border-radius: 0.5rem;
    background: var(--white);
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    text-align: center;
}

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

.danger-btn {
    padding: 0.625rem 1rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--danger);
    color: var(--white);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

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

.text-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

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

/* Share section */
.share-section {
    margin-top: 2rem;
    background: var(--white);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.share-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.share-link-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.share-link-container input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--bg);
}

.copy-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--primary);
    color: var(--white);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

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

.share-hint {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* Footer features */
.info {
    margin-top: auto;
    padding-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.feature .icon {
    font-size: 1rem;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* ===== Session Page ===== */
.session-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.timer {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--bg);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.timer-icon {
    font-size: 1rem;
}

/* Map */
#map {
    flex: 1;
    z-index: 1;
}

/* Bottom panel */
.bottom-panel {
    background: var(--white);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.panel-content {
    padding: 1.25rem 1rem;
}

.panel-content h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

#join-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#join-form input,
#edit-form input {
    padding: 0.875rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
}

#join-form input:focus,
#edit-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.privacy-note {
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: center;
    margin-top: 0.5rem;
}

/* Sharing state */
.sharing-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pulse {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.sharing-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Edit form */
#edit-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

#edit-form input {
    flex: 1;
}

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

/* Warning state */
.warning-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #FEF3C7;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.warning-icon {
    font-size: 1.25rem;
}

.warning-message p {
    font-size: 0.875rem;
    color: #92400E;
}

/* Participants section */
.participants-section {
    border-top: 1px solid var(--border);
}

.toggle-btn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--text-light);
    cursor: pointer;
}

.toggle-btn .chevron {
    transition: transform 0.2s ease;
}

.toggle-btn.open .chevron {
    transform: rotate(180deg);
}

.participants-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
}

.participants-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.participants-list li:last-child {
    border-bottom: none;
}

.participant-name {
    font-weight: 500;
}

.participant-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Expired page */
.expired-content {
    text-align: center;
    background: var(--white);
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow);
}

.expired-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.expired-content h2 {
    margin-bottom: 0.75rem;
}

.expired-content p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* Leaflet custom marker */
.custom-marker {
    background: var(--primary);
    border: 3px solid var(--white);
    border-radius: 50%;
    box-shadow: var(--shadow);
}

.marker-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--shadow);
    margin-top: 0.25rem;
}

/* Responsive */
@media (min-width: 640px) {
    .duration-options {
        grid-template-columns: repeat(4, 1fr);
    }

    .panel-content {
        padding: 1.5rem 2rem;
    }

    #join-form {
        flex-direction: row;
    }

    #join-form input {
        flex: 1;
    }

    #join-form button {
        width: auto;
        white-space: nowrap;
    }
}
