/**
 * TGuide Map Styles
 * Common styles for map components
 */

/* Map Container */
.tguide-map-container {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tguide-map {
    width: 100%;
    height: 400px;
    z-index: 1;
}

.tguide-map-fullscreen {
    height: 100vh;
}

/* Search Box */
.tguide-map-search {
    position: absolute;
    top: 10px;
    left: 50px;
    right: 50px;
    z-index: 1000;
}

.tguide-map-search input {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    font-size: 14px;
}

.tguide-map-search input:focus {
    outline: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Search Results Dropdown */
.tguide-map-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.tguide-map-search-results.active {
    display: block;
}

.tguide-map-search-results ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tguide-map-search-results li {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.tguide-map-search-results li:hover {
    background: #f5f5f5;
}

.tguide-map-search-results li:last-child {
    border-bottom: none;
}

.tguide-map-search-results .result-name {
    display: block;
    font-weight: 600;
    color: #333;
}

.tguide-map-search-results .result-address {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

/* Coordinates Display */
.tguide-map-coords {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tguide-map-coords span {
    margin-right: 15px;
}

/* Controls */
.tguide-map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tguide-map-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 4px;
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tguide-map-btn:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

.tguide-map-btn:active {
    transform: scale(0.95);
}

.tguide-map-btn svg {
    width: 20px;
    height: 20px;
    fill: #333;
}

.tguide-map-btn.active {
    background: #007bff;
}

.tguide-map-btn.active svg {
    fill: white;
}

/* Geolocation Button */
.tguide-map-btn-locate {
    background: white;
}

.tguide-map-btn-locate.tracking {
    background: #28a745;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* Address Display */
.tguide-map-address {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: 80%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Form Integration */
.tguide-map-form {
    margin-top: 15px;
}

.tguide-map-form .form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.tguide-map-form .form-group {
    flex: 1;
}

.tguide-map-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
    color: #555;
}

.tguide-map-form input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.tguide-map-form input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.tguide-map-form input[readonly] {
    background: #f8f9fa;
    color: #666;
}

/* Point List */
.tguide-points-list {
    margin-top: 15px;
}

.tguide-point-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.tguide-point-item .point-number {
    width: 30px;
    height: 30px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
}

.tguide-point-item .point-info {
    flex: 1;
    min-width: 0;
}

.tguide-point-item .point-name {
    font-weight: 600;
    color: #333;
}

.tguide-point-item .point-coords {
    font-size: 12px;
    color: #666;
}

.tguide-point-item .point-actions {
    display: flex;
    gap: 5px;
}

.tguide-point-item .point-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.tguide-point-item .point-actions .btn-edit {
    background: #ffc107;
    color: #333;
}

.tguide-point-item .point-actions .btn-delete {
    background: #dc3545;
    color: white;
}

/* Loading State */
.tguide-map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.tguide-map-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tguide-map {
        height: 300px;
    }

    .tguide-map-search {
        left: 10px;
        right: 10px;
    }

    .tguide-map-form .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .tguide-map-address {
        max-width: 90%;
        font-size: 12px;
        padding: 8px 15px;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .tguide-map-search input {
        background: #2d2d2d;
        color: #fff;
    }

    .tguide-map-search-results {
        background: #2d2d2d;
    }

    .tguide-map-search-results li {
        border-color: #444;
    }

    .tguide-map-search-results li:hover {
        background: #3d3d3d;
    }

    .tguide-map-search-results .result-name {
        color: #fff;
    }

    .tguide-map-search-results .result-address {
        color: #aaa;
    }

    .tguide-map-coords,
    .tguide-map-address {
        background: rgba(45, 45, 45, 0.95);
        color: #fff;
    }

    .tguide-map-btn {
        background: #2d2d2d;
    }

    .tguide-map-btn svg {
        fill: #fff;
    }

    .tguide-map-btn:hover {
        background: #3d3d3d;
    }
}
