/* Reset et configuration de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --success-hover: #059669;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --warning-color: #f59e0b;
    --warning-hover: #d97706;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    --transition-fast: 0.15s ease-out;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translate(-50px, -50px) rotate(0deg); }
    100% { transform: translate(-50px, -50px) rotate(360deg); }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    animation: slideInDown 0.8s var(--transition-bounce);
}

.header h1 i {
    margin-right: 0.5rem;
    color: #fbbf24;
}

.header p {
    font-size: 1.125rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    animation: slideInUp 0.8s var(--transition-bounce) 0.2s both;
}

/* Main content */
.main {
    padding: 3rem 0;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all var(--transition-smooth);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s var(--transition-smooth) forwards;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }

.card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.card h2 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* Input section */
.address-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.address-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all var(--transition-smooth);
    background-color: #fafafa;
    position: relative;
}

.address-input::placeholder {
    transition: all var(--transition-smooth);
}

.address-input:hover {
    border-color: var(--primary-color);
    background-color: white;
}

.address-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

.address-input:focus::placeholder {
    opacity: 0.5;
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.6s;
    transform: translate(-50%, -50%);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0) scale(1.02);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

.btn-success:active {
    transform: translateY(0) scale(1.02);
}

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

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

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    padding: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Address list */
.addresses-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    background-color: #fafafa;
}

.address-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-smooth);
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInRight 0.4s var(--transition-smooth) forwards;
}

.address-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.address-item:nth-child(1) { animation-delay: 0.1s; }
.address-item:nth-child(2) { animation-delay: 0.2s; }
.address-item:nth-child(3) { animation-delay: 0.3s; }
.address-item:nth-child(4) { animation-delay: 0.4s; }
.address-item:nth-child(5) { animation-delay: 0.5s; }

.address-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.address-status {
    margin-left: 1rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

.status-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-success {
    background-color: #d1fae5;
    color: #065f46;
}

.status-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
}

/* Results */
.results-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid var(--success-color);
}

.result-content {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.result-address {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border-left: 4px solid var(--success-color);
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Map */
.map-container {
    height: 400px;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

/* Info section */
.info-section {
    margin-top: 3rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.info-item {
    text-align: center;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.info-item i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.info-item h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.info-item p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 2rem 0;
}

.footer p {
    opacity: 0.8;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    background: white;
    padding: 2.5rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    max-width: 320px;
    min-width: 280px;
}

.loading-content p {
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

/* Modern Spinner */
.modern-spinner {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

.spinner-ring:nth-child(1) {
    border-top-color: var(--primary-color);
    animation-duration: 1.5s;
}

.spinner-ring:nth-child(2) {
    border-right-color: var(--success-color);
    animation-duration: 2s;
    animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
    border-bottom-color: var(--warning-color);
    animation-duration: 2.5s;
}

/* Progress Bar */
.loading-progress {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

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

/* Nouvelles animations UX */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 20%, 60%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    80% {
        transform: translateY(-5px);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 30px rgba(59, 130, 246, 0.6);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-xl);
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 350px;
    pointer-events: auto;
    transform: translateX(400px);
    opacity: 0;
    transition: all var(--transition-smooth);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast-icon {
    font-size: 1.125rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--background-color);
    color: var(--text-primary);
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--text-primary);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 1002;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    white-space: nowrap;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-primary);
}

.tooltip.show {
    opacity: 1;
}

/* Status Indicators with better animations */
.status-pending {
    background-color: #fef3c7;
    color: #92400e;
    animation: pulse 2s infinite;
}

.status-success {
    background-color: #d1fae5;
    color: #065f46;
    animation: bounce 0.6s ease-out;
}

.status-error {
    background-color: #fee2e2;
    color: #991b1b;
    animation: shake 0.5s ease-out;
}

/* Results animation */
.results-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid var(--success-color);
    transform: scale(0.95);
    opacity: 0;
    transition: all var(--transition-bounce);
}

.results-card.show {
    transform: scale(1);
    opacity: 1;
    animation: heartbeat 0.8s ease-out;
}

/* Enhanced button states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-calculating {
    animation: glow 2s infinite;
}

/* Responsive design */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    .address-input-group {
        flex-direction: column;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .map-container {
        height: 300px;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .header {
        padding: 1.5rem 0;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .main {
        padding: 2rem 0;
    }
    
    .card {
        padding: 1rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}