/* ======================================
   CactusIO Store - Tracking Components CSS
   Styles für Package Tracking mit interaktiver Karte
   VERBESSERTE RANDABSTÄNDE
====================================== */

/* ===== TRACKING SEARCH FORM - Verbesserte Abstände ===== */
.tracking-search-form {
    max-width: 600px;
    margin: 0 auto var(--space-3xl);
    background: var(--store-glass);
    backdrop-filter: blur(var(--glass-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--glass-backdrop-blur));
    border: 1px solid var(--store-glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-3xl);
    box-shadow: var(--shadow-xl);
    margin-left: var(--space-lg); /* Zusätzliche horizontale Margin */
    margin-right: var(--space-lg); /* Zusätzliche horizontale Margin */
}

.search-header {
    text-align: center;
    margin-bottom: var(--space-3xl); /* Erhöhte Margin */
}

.search-header .page-title {
    font-size: 2.5rem;
    color: var(--store-primary);
    margin-bottom: var(--space-lg); /* Erhöhte Margin */
    background: linear-gradient(135deg, var(--store-primary), var(--store-primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-header .page-subtitle {
    color: var(--store-text-muted);
    font-size: 1.1rem;
    margin: 0;
}

.tracking-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl); /* Erhöhter Gap */
}

.tracking-form .form-group {
    margin-bottom: 0;
}

.tracking-form input {
    font-size: 1rem;
    padding: var(--space-lg) var(--space-xl); /* Erhöhtes Padding */
    border-radius: var(--radius-md);
}

.tracking-form .form-hint {
    font-style: italic;
}

.tracking-form .form-actions {
    margin-top: var(--space-xl); /* Erhöhte Margin */
    justify-content: center;
}

/* ===== TRACKING RESULTS - Verbesserte Abstände ===== */
.tracking-results {
    animation: fadeInUp 0.5s ease-out;
    padding: 0 var(--space-lg); /* Zusätzliches Padding */
}

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

.tracking-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-3xl); /* Erhöhte Margin */
    padding: var(--space-2xl); /* Erhöhtes Padding */
    background: var(--store-glass);
    backdrop-filter: blur(var(--glass-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--glass-backdrop-blur));
    border: 1px solid var(--store-glass-border);
    border-radius: var(--radius-lg);
    margin-left: var(--space-md); /* Zusätzliche horizontale Margin */
    margin-right: var(--space-md); /* Zusätzliche horizontale Margin */
}

.order-info h1.order-number {
    font-size: 2.2rem;
    color: var(--store-primary);
    margin-bottom: var(--space-md); /* Erhöhte Margin */
}

.tracking-actions {
    display: flex;
    gap: var(--space-lg); /* Erhöhter Gap */
    align-items: center;
}

/* ===== DELIVERY STATUS CARD - Verbesserte Abstände ===== */
.delivery-status-card {
    display: flex;
    align-items: center;
    gap: var(--space-2xl); /* Erhöhter Gap */
    background: linear-gradient(135deg, 
        var(--store-glass) 0%, 
        rgba(104, 190, 124, 0.1) 100%);
    backdrop-filter: blur(var(--glass-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--glass-backdrop-blur));
    border: 1px solid var(--store-glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl); /* Erhöhtes Padding */
    margin-bottom: var(--space-3xl); /* Erhöhte Margin */
    position: relative;
    overflow: hidden;
    margin-left: var(--space-md); /* Zusätzliche horizontale Margin */
    margin-right: var(--space-md); /* Zusätzliche horizontale Margin */
}

.delivery-status-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--store-primary);
}

.status-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--store-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--store-dark);
    font-size: 2rem;
    flex-shrink: 0;
    box-shadow: var(--glow-subtle);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: var(--glow-subtle);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: var(--glow-strong);
    }
}

.status-icon.delivered {
    background: var(--store-success);
    animation: none;
}

.status-icon.shipped {
    background: var(--store-primary);
}

.status-icon.processing {
    background: var(--store-warning);
}

.status-icon.pending {
    background: var(--store-text-muted);
}

.status-content {
    flex: 1;
}

.status-content h3 {
    color: var(--store-text);
    font-size: 1.5rem;
    margin-bottom: var(--space-md); /* Erhöhte Margin */
}

.status-content p {
    color: var(--store-text-muted);
    margin-bottom: var(--space-lg); /* Erhöhte Margin */
    font-size: 1.1rem;
}

.estimated-delivery {
    display: flex;
    align-items: center;
    gap: var(--space-md); /* Erhöhter Gap */
    color: var(--store-primary);
    font-weight: var(--font-weight-medium);
    background: rgba(104, 190, 124, 0.1);
    padding: var(--space-md) var(--space-lg); /* Erhöhtes Padding */
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--store-primary);
}

.estimated-delivery i {
    font-size: 1.1rem;
}

/* ===== TRACKING CONTENT GRID - Verbesserte Abstände ===== */
.tracking-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl); /* Erhöhter Gap */
    margin-bottom: var(--space-3xl); /* Erhöhte Margin */
    padding: 0 var(--space-lg); /* Zusätzliches Padding */
}

/* ===== TRACKING MAP - Verbesserte Abstände ===== */
.tracking-map-section {
    background: var(--store-glass);
    backdrop-filter: blur(var(--glass-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--glass-backdrop-blur));
    border: 1px solid var(--store-glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl); /* Erhöhtes Padding */
    margin: var(--space-sm); /* Zusätzliche Margin */
}

.map-container {
    position: relative;
    height: 400px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-xl); /* Erhöhte Margin */
    border: 1px solid var(--store-glass-border);
}

.tracking-map {
    width: 100%;
    height: 100%;
    background: var(--store-surface);
}

.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--store-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg); /* Erhöhter Gap */
    color: var(--store-text-muted);
}

.map-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--store-glass-border);
    border-top: 3px solid var(--store-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.map-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-xl); /* Erhöhter Gap */
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-md); /* Erhöhter Gap */
    color: var(--store-text-muted);
    font-size: 0.9rem;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.legend-marker.origin {
    background: var(--store-success);
}

.legend-marker.current {
    background: var(--store-primary);
    animation: markerPulse 2s ease-in-out infinite;
}

.legend-marker.destination {
    background: var(--store-error);
}

@keyframes markerPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    50% { 
        transform: scale(1.3);
        box-shadow: 0 4px 8px rgba(104, 190, 124, 0.5);
    }
}

/* ===== TRACKING TIMELINE - Verbesserte Abstände ===== */
.tracking-timeline-section {
    background: var(--store-glass);
    backdrop-filter: blur(var(--glass-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--glass-backdrop-blur));
    border: 1px solid var(--store-glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl); /* Erhöhtes Padding */
    margin: var(--space-sm); /* Zusätzliche Margin */
}

.tracking-timeline {
    position: relative;
    margin-bottom: var(--space-3xl); /* Erhöhte Margin */
}

.tracking-timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--store-glass-border);
}

.timeline-event {
    position: relative;
    padding-left: 60px;
    margin-bottom: var(--space-2xl); /* Erhöhte Margin */
    animation: timelineSlideIn 0.5s ease-out;
    animation-fill-mode: both;
}

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

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

.timeline-event:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -40px;
    top: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--store-surface);
    border: 3px solid var(--store-glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--store-text-muted);
    z-index: 2;
}

.timeline-event.completed .timeline-marker {
    background: var(--store-primary);
    border-color: var(--store-primary);
    color: var(--store-dark);
    box-shadow: var(--glow-subtle);
}

.timeline-event.current .timeline-marker {
    background: var(--store-warning);
    border-color: var(--store-warning);
    color: var(--store-dark);
    animation: currentMarkerPulse 2s ease-in-out infinite;
}

@keyframes currentMarkerPulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4);
    }
    50% { 
        box-shadow: 0 0 0 15px rgba(255, 152, 0, 0);
    }
}

.timeline-content {
    background: var(--store-surface);
    border: 1px solid var(--store-glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-xl); /* Erhöhtes Padding */
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md); /* Erhöhte Margin */
}

.timeline-title {
    color: var(--store-text);
    font-weight: var(--font-weight-medium);
    font-size: 1.1rem;
    margin: 0;
}

.timeline-time {
    color: var(--store-text-muted);
    font-size: 0.9rem;
    font-weight: var(--font-weight-normal);
}

.timeline-description {
    color: var(--store-text-muted);
    margin: 0;
    line-height: 1.5;
}

.timeline-location {
    color: var(--store-primary);
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    margin-top: var(--space-md); /* Erhöhte Margin */
    display: flex;
    align-items: center;
    gap: var(--space-sm); /* Erhöhter Gap */
}

.timeline-location i {
    font-size: 0.8rem;
}

/* ===== PACKAGE DETAILS - Verbesserte Abstände ===== */
.package-details {
    background: var(--store-surface);
    border: 1px solid var(--store-glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-xl); /* Erhöhtes Padding */
}

.package-details h4 {
    color: var(--store-text);
    font-size: 1.1rem;
    margin-bottom: var(--space-xl); /* Erhöhte Margin */
    padding-bottom: var(--space-md); /* Erhöhtes Padding */
    border-bottom: 1px solid var(--store-glass-border);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-lg); /* Erhöhte Margin */
    align-items: center;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    color: var(--store-text-muted);
    font-size: 0.9rem;
}

.detail-value {
    color: var(--store-text);
    font-weight: var(--font-weight-medium);
    font-size: 0.9rem;
    text-align: right;
    flex: 1;
    margin-left: var(--space-lg); /* Erhöhte Margin */
}

.detail-value.tracking-number {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    background: var(--store-dark);
    color: var(--store-primary);
    padding: var(--space-sm) var(--space-md); /* Erhöhtes Padding */
    border-radius: var(--radius-xs);
    border: 1px solid var(--store-glass-border);
}

/* ===== ORDER ITEMS PREVIEW IN TRACKING - Verbesserte Abstände ===== */
.order-items-preview {
    background: var(--store-glass);
    backdrop-filter: blur(var(--glass-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--glass-backdrop-blur));
    border: 1px solid var(--store-glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl); /* Erhöhtes Padding */
    margin: var(--space-md); /* Zusätzliche Margin */
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-xl); /* Erhöhter Gap */
}

.tracking-item-card {
    background: var(--store-surface);
    border: 1px solid var(--store-glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-xl); /* Erhöhtes Padding */
    transition: var(--transition-normal);
    margin: var(--space-sm); /* Zusätzliche Margin */
}

.tracking-item-card:hover {
    border-color: var(--store-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tracking-item-header {
    display: flex;
    gap: var(--space-lg); /* Erhöhter Gap */
    margin-bottom: var(--space-lg); /* Erhöhte Margin */
}

.tracking-item-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

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

.tracking-item-name {
    color: var(--store-text);
    font-weight: var(--font-weight-medium);
    font-size: 1rem;
    margin-bottom: var(--space-sm); /* Erhöhte Margin */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tracking-item-quantity {
    color: var(--store-text-muted);
    font-size: 0.9rem;
}

.tracking-item-status {
    display: flex;
    align-items: center;
    gap: var(--space-md); /* Erhöhter Gap */
    padding: var(--space-md); /* Erhöhtes Padding */
    background: rgba(104, 190, 124, 0.1);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--store-primary);
}

.tracking-item-status i {
    color: var(--store-primary);
    font-size: 0.9rem;
}

.tracking-item-status span {
    color: var(--store-text);
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
}

/* ===== LEAFLET MAP CUSTOMIZATION ===== */
.leaflet-container {
    background: var(--store-surface);
    font-family: inherit;
}

.leaflet-popup-content-wrapper {
    background: var(--store-glass);
    backdrop-filter: blur(var(--glass-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--glass-backdrop-blur));
    border: 1px solid var(--store-glass-border);
    border-radius: var(--radius-md);
    color: var(--store-text);
}

.leaflet-popup-content {
    color: var(--store-text);
    font-size: 0.9rem;
    line-height: 1.4;
}

.leaflet-popup-tip {
    background: var(--store-glass);
    border: 1px solid var(--store-glass-border);
}

.leaflet-control-zoom a {
    background: var(--store-glass);
    backdrop-filter: blur(var(--glass-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--glass-backdrop-blur));
    border: 1px solid var(--store-glass-border);
    color: var(--store-text);
}

.leaflet-control-zoom a:hover {
    background: var(--store-primary);
    color: var(--store-dark);
    border-color: var(--store-primary);
}

/* ===== CUSTOM MAP MARKERS ===== */
.custom-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
}

.custom-marker.origin {
    background: var(--store-success);
}

.custom-marker.current {
    background: var(--store-primary);
    animation: markerBounce 1s ease-in-out infinite;
}

.custom-marker.destination {
    background: var(--store-error);
}

@keyframes markerBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ===== RESPONSIVE DESIGN - Verbesserte Abstände ===== */
@media (max-width: 1024px) {
    .tracking-content-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl); /* Reduzierter Gap für kleinere Bildschirme */
        padding: 0 var(--space-md);
    }
    
    .tracking-header {
        flex-direction: column;
        gap: var(--space-lg);
        margin-left: var(--space-sm);
        margin-right: var(--space-sm);
        padding: var(--space-xl);
    }
    
    .delivery-status-card {
        flex-direction: column;
        text-align: center;
        gap: var(--space-xl);
        margin-left: var(--space-sm);
        margin-right: var(--space-sm);
        padding: var(--space-xl);
    }
    
    .items-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .tracking-search-form {
        margin-left: var(--space-sm);
        margin-right: var(--space-sm);
    }
}

@media (max-width: 768px) {
    .tracking-main {
        padding-top: 80px;
    }
    
    .tracking-search-form {
        margin: 0 var(--space-md) var(--space-2xl);
        padding: var(--space-2xl);
    }
    
    .search-header .page-title {
        font-size: 2rem;
    }
    
    .tracking-form .form-actions {
        flex-direction: column;
    }
    
    .tracking-header {
        padding: var(--space-lg);
        margin-left: var(--space-xs);
        margin-right: var(--space-xs);
    }
    
    .order-info h1.order-number {
        font-size: 1.8rem;
    }
    
    .delivery-status-card {
        padding: var(--space-lg);
        margin-left: var(--space-xs);
        margin-right: var(--space-xs);
    }
    
    .status-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .status-content h3 {
        font-size: 1.3rem;
    }
    
    .tracking-timeline-section,
    .tracking-map-section {
        padding: var(--space-lg);
        margin: var(--space-xs);
    }
    
    .map-container {
        height: 300px;
    }
    
    .timeline-event {
        padding-left: 50px;
    }
    
    .timeline-marker {
        left: -35px;
        width: 35px;
        height: 35px;
    }
    
    .timeline-marker i {
        font-size: 0.9rem;
    }
    
    .map-legend {
        gap: var(--space-lg);
    }
    
    .legend-item {
        font-size: 0.8rem;
        gap: var(--space-sm);
    }
    
    .tracking-content-grid {
        padding: 0 var(--space-sm);
    }
    
    .tracking-results {
        padding: 0 var(--space-sm);
    }
    
    .order-items-preview {
        margin: var(--space-xs);
        padding: var(--space-lg);
    }
    
    .tracking-item-card {
        margin: 0;
        padding: var(--space-lg);
    }
}

@media (max-width: 576px) {
    .tracking-search-form {
        padding: var(--space-lg);
        margin: 0 var(--space-sm) var(--space-xl);
    }
    
    .search-header .page-title {
        font-size: 1.8rem;
    }
    
    .delivery-status-card {
        padding: var(--space-md);
        margin-left: 0;
        margin-right: 0;
    }
    
    .tracking-actions {
        flex-direction: column;
        width: 100%;
        gap: var(--space-md);
    }
    
    .tracking-actions .btn {
        justify-content: center;
    }
    
    .timeline-header {
        flex-direction: column;
        gap: var(--space-sm);
        align-items: flex-start;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .detail-value {
        text-align: left;
        margin-left: 0;
    }
    
    .tracking-item-card {
        padding: var(--space-md);
    }
    
    .estimated-delivery {
        flex-direction: column;
        text-align: center;
        gap: var(--space-md);
    }
    
    .tracking-header {
        margin-left: 0;
        margin-right: 0;
        padding: var(--space-md);
    }
    
    .tracking-timeline-section,
    .tracking-map-section {
        margin: 0;
        padding: var(--space-md);
    }
    
    .order-items-preview {
        margin: 0;
        padding: var(--space-md);
    }
    
    .tracking-content-grid {
        padding: 0;
        gap: var(--space-lg);
    }
    
    .tracking-results {
        padding: 0;
    }
    
    .timeline-content {
        padding: var(--space-lg);
    }
    
    .package-details {
        padding: var(--space-lg);
    }
    
    .tracking-item-header {
        gap: var(--space-md);
        margin-bottom: var(--space-md);
    }
    
    .timeline-event {
        margin-bottom: var(--space-lg);
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .timeline-event {
        animation: none;
    }
    
    .status-icon,
    .legend-marker.current,
    .timeline-marker,
    .custom-marker.current {
        animation: none;
    }
    
    .tracking-item-card:hover {
        transform: none;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .tracking-search-form,
    .delivery-status-card,
    .tracking-timeline-section,
    .tracking-map-section {
        border: 2px solid var(--store-text);
    }
    
    .timeline-marker,
    .legend-marker {
        border-width: 3px;
    }
}