/**
 * Compact Address Management Styles
 * استایل‌های جمع و جور برای مدیریت آدرس
 */

/* Global Variables */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow-light: 0 2px 8px rgba(111, 66, 193, 0.1);
    --shadow-medium: 0 4px 15px rgba(111, 66, 193, 0.2);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* Main Container */
.address-management-container {
    background: #f5f7fa;
    min-height: 100vh;
    padding: 1.5rem 0;
}

/* Header Section */
.address-header {
    background: var(--primary-gradient);
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-medium);
}

.address-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.address-header p {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* کارت‌های کوچک و جمع‌وجور */
.address-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    overflow: hidden;
}

.address-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
    border-color: #6f42c1;
}

.address-card .card-header {
    background: linear-gradient(135deg, #f8f7fc 0%, #eee9f7 100%);
    border: none;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9ecef;
}

.address-card .card-body {
    padding: 1rem;
}

.address-card .card-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 0.75rem 1rem;
}

/* Address Title - کوچکتر */
.address-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0;
}

.address-title i {
    color: #667eea;
    font-size: 0.9rem;
}

/* Default Badge - کوچکتر */
.default-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
}

/* Address Info - جمع‌وجورتر */
.address-info {
    display: grid;
    gap: 0.5rem;
}

.address-info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 2px solid #667eea;
    transition: var(--transition);
}

.address-info-item:hover {
    background: #e9ecef;
    transform: translateX(3px);
}

.address-info-item i {
    color: #667eea;
    font-size: 0.8rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.address-info-content h6 {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.1rem;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.address-info-content p {
    margin: 0;
    color: #6c757d;
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Coordinates - خیلی کوچکتر */
.coordinates-display {
    background: var(--primary-gradient);
    color: white;
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.7rem;
}

.coordinate-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.2rem;
}

.coordinate-item:last-child {
    margin-bottom: 0;
}

.coordinate-label {
    font-weight: 600;
    font-size: 0.65rem;
    opacity: 0.9;
}

.coordinate-value {
    font-family: 'Courier New', monospace;
    background: rgba(255,255,255,0.2);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
}

/* Address Actions - کوچکتر */
.address-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.address-actions .btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.4rem 0.7rem;
    transition: var(--transition);
    font-size: 0.75rem;
    flex: 1;
}

.address-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.btn-outline-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
}

.btn-outline-primary:hover {
    opacity: 0.9;
    color: white;
}

.btn-outline-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: white;
    border: none;
}

.btn-outline-warning:hover {
    opacity: 0.9;
    color: white;
}

.btn-outline-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
}

.btn-outline-danger:hover {
    opacity: 0.9;
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.empty-state i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: #2c3e50;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
}

.empty-state p {
    color: #6c757d;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* Buttons */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

/* Alerts - کوچکتر */
.alert-success-custom,
.alert-error-custom {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    border: none;
}

.alert-success-custom {
    background: #d4edda;
    color: #155724;
    border-left: 3px solid #28a745;
}

.alert-error-custom {
    background: #f8d7da;
    color: #721c24;
    border-left: 3px solid #dc3545;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Map Container */
.map-container {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    background: white;
    border: 1px solid #e0e0e0;
}

.map-container #map {
    width: 100%;
    height: 400px;
    min-height: 400px;
    border-radius: var(--border-radius);
}

/* Global Leaflet Map Container Fixes */
.leaflet-container {
    background-color: #f5f5f5 !important;
    background-image: none !important;
}

.leaflet-container img {
    max-width: none !important;
}

/* Ensure all map containers have minimum height */
[id*="map"], [id*="Map"], [class*="map"] {
    min-height: 200px;
}

/* Fix for gray map issue - ensure tiles load properly */
.leaflet-tile-container img {
    opacity: 1 !important;
    visibility: visible !important;
}

.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
}

.map-controls .btn {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
}

.map-controls .btn:hover {
    background: #f8f9fa;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.map-controls .btn i {
    color: #667eea;
    font-size: 1rem;
}

/* Search Results */
.search-results {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 0.5rem;
}

.search-result-item {
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

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

/* Form Styles */
.address-form {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-light);
}

.address-form .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.address-form .form-label i {
    color: #667eea;
}

.address-form .form-label.required::after {
    content: '*';
    color: #dc3545;
    margin-right: 0.25rem;
}

.address-form .form-control {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.75rem;
    transition: var(--transition);
}

.address-form .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.address-form .input-group {
    position: relative;
}

.address-form .input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .address-header h1 {
        font-size: 1.3rem;
    }
    
    .address-card .card-header,
    .address-card .card-body,
    .address-card .card-footer {
        padding: 0.75rem;
    }
    
    .address-actions {
        flex-direction: column;
    }
    
    .address-actions .btn {
        width: 100%;
    }
    
    .map-container #map {
        height: 300px;
        min-height: 300px;
    }
    
    .address-form {
        padding: 1rem;
    }
}
