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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 1.5em;
    font-weight: 600;
}

.btn-toggle {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
}

.btn-toggle:hover {
    background: rgba(255,255,255,0.3);
}

.controls {
    background-color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.controls.collapsed {
    max-height: 0;
    padding: 0 20px;
    opacity: 0;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

input[type="text"]:read-only {
    background-color: #f9f9f9;
    cursor: text;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: #4caf50;
    color: white;
    padding: 10px 15px;
}

.btn-secondary:hover {
    background-color: #45a049;
}

.btn-audio {
    background-color: #ff9800;
    color: white;
    padding: 10px 15px;
}

.btn-audio:hover {
    background-color: #f57c00;
}

.btn-wakelock {
    background-color: #9c27b0;
    color: white;
    padding: 10px 15px;
}

.btn-wakelock:hover {
    background-color: #7b1fa2;
}

.btn-wakelock.active {
    background-color: #4caf50;
}

.url-display {
    margin-top: 10px;
}

.url-display label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.url-box {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.url-box input {
    flex: 1 1 100%;
}

.url-box button {
    flex: 1 1 auto;
}

.hidden {
    display: none !important;
}

.error {
    background-color: #ff5252;
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-weight: 500;
}

.status {
    background-color: #4caf50;
    color: white;
    padding: 8px 20px;
    text-align: center;
    font-size: 0.9em;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status:empty {
    min-height: 0;
    padding: 0;
}

.persons-list {
    position: absolute;
    top: 240px;
    right: 20px;
    background-color: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 250px;
    max-height: 300px;
    overflow-y: auto;
}

.persons-list h3 {
    font-size: 1em;
    margin-bottom: 10px;
    color: #667eea;
}

.persons-list ul {
    list-style: none;
}

.persons-list li {
    padding: 8px 12px;
    background-color: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
}

.persons-list li:before {
    content: '📍';
    margin-right: 8px;
}

#map {
    flex: 1;
    z-index: 1;
}

@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
    }

    .persons-list {
        top: auto;
        bottom: 20px;
        right: 20px;
        left: 20px;
        max-width: none;
        max-height: 150px;
    }

    h1 {
        font-size: 1.2em;
    }
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 12px;
    font-size: 14px;
}

.popup-name {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 4px;
}

.popup-time {
    font-size: 12px;
    color: #666;
}

.persons-list li {
    justify-content: space-between;
}

.person-name {
    flex: 1;
}

.person-time {
    font-size: 0.8em;
    color: #888;
    margin-left: 8px;
}

.debug-log {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #0f0;
    font-family: monospace;
    font-size: 11px;
    padding: 10px;
    border-radius: 8px;
    max-width: 300px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 1000;
}

.debug-log:empty {
    display: none;
}
