/**
 * Offline Maps CSS Styles
 * Styles for tiles management UI and offline indicators
 */

/* ====================================
   Tiles Management Page
   ==================================== */

.tiles-management-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.tiles-management-header {
    margin-bottom: 30px;
}

.tiles-management-header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 10px;
}

.tiles-management-header p {
    color: #6c757d;
    margin-bottom: 0;
}

/* ====================================
   Status Indicators
   ==================================== */

.status-card {
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-card.online {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.status-card.offline {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    color: white;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.875rem;
}

.status-indicator.online {
    background-color: #28a745;
    color: white;
}

.status-indicator.offline {
    background-color: #dc3545;
    color: white;
}

.status-indicator i {
    font-size: 1rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* ====================================
   Tabs
   ==================================== */

.tiles-tabs {
    margin-bottom: 30px;
}

.tiles-tabs .nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.tiles-tabs .nav-link {
    color: #495057;
    font-weight: 500;
    padding: 12px 20px;
    border: none;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tiles-tabs .nav-link:hover {
    color: #007bff;
    border-bottom-color: #007bff;
}

.tiles-tabs .nav-link.active {
    color: #007bff;
    background-color: transparent;
    border-bottom-color: #007bff;
}

/* ====================================
   Search Bar
   ==================================== */

.tiles-search-bar {
    margin-bottom: 20px;
}

.tiles-search-input {
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid #ced4da;
    transition: border-color 0.2s ease;
}

.tiles-search-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ====================================
   Tile Region Cards
   ==================================== */

.tile-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.tile-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.tile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.tile-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 5px;
}

.tile-card-code {
    font-size: 0.875rem;
    color: #6c757d;
    font-family: monospace;
}

.tile-card-body {
    margin-bottom: 15px;
}

.tile-card-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.tile-info-item {
    display: flex;
    flex-direction: column;
}

.tile-info-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.tile-info-value {
    font-size: 1rem;
    color: #212529;
    font-weight: 500;
}

.tile-card-description {
    font-size: 0.875rem;
    color: #495057;
    line-height: 1.5;
    margin-bottom: 15px;
}

.tile-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tile-card-actions .btn {
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* ====================================
   Progress Bar
   ==================================== */

.download-progress-container {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    display: none;
}

.download-progress-container.active {
    display: block;
}

.download-progress-label {
    font-size: 0.875rem;
    color: #495057;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.download-progress-bar {
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.download-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff 0%, #0056b3 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ====================================
   Badges
   ==================================== */

.tile-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.tile-type-badge.vector {
    background-color: #e3f2fd;
    color: #1976d2;
}

.tile-type-badge.raster {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.downloaded-badge {
    background-color: #d4edda;
    color: #155724;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ====================================
   Empty State
   ==================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.empty-state-icon {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 20px;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
}

.empty-state-text {
    font-size: 1rem;
    color: #6c757d;
    margin-bottom: 20px;
}

/* ====================================
   Storage Info
   ==================================== */

.storage-info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.storage-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.storage-info-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0;
}

.storage-info-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.storage-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.storage-stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.storage-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.storage-progress {
    height: 8px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.storage-progress-fill {
    height: 100%;
    background-color: white;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ====================================
   Floating Offline Indicator (for map page)
   ==================================== */

.map-offline-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.map-offline-indicator.online {
    background-color: #28a745;
    color: white;
}

.map-offline-indicator.offline {
    background-color: #dc3545;
    color: white;
}

.map-offline-indicator i {
    font-size: 1rem;
}

/* ====================================
   Loading States
   ==================================== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

/* ====================================
   Responsive Design
   ==================================== */

@media (max-width: 768px) {
    .tiles-management-container {
        padding: 15px;
    }

    .tiles-management-header h1 {
        font-size: 1.5rem;
    }

    .tile-card {
        padding: 15px;
    }

    .tile-card-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tile-card-actions {
        flex-direction: column;
    }

    .tile-card-actions .btn {
        width: 100%;
    }

    .storage-info-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 576px) {
    .status-card {
        padding: 15px;
    }

    .tile-card-header {
        flex-direction: column;
        gap: 10px;
    }
}

/* ====================================
   Modal Styles
   ==================================== */

.modal-progress {
    padding: 20px;
}

.modal-progress-text {
    text-align: center;
    margin-bottom: 15px;
    color: #495057;
}

.modal-progress-bar-container {
    height: 12px;
    background-color: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.modal-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff 0%, #0056b3 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

.modal-progress-percent {
    text-align: center;
    font-weight: 600;
    font-size: 1.5rem;
    color: #007bff;
}
