/* PathFinder - Custom Styles */

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
    line-height: 1.4;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    /* Removed padding-bottom that reserved space for footer */
}

.container-fluid {
    height: 100vh;
    padding: 0;
}

.row {
    height: 100vh;
    margin: 0;
}

/* Map Styles */
#map {
    height: 100vh !important; /* Full viewport height now that footer removed */
    width: 100% !important;
    z-index: 1;
}

/* Control Panel Styles */
.col-md-3 {
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    max-height: 100vh;
    -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.col-md-3, .col-md-3 * {
    scrollbar-width: none !important;
}
.col-md-3 *::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}

.col-md-9 {
    width: 100% !important;
    flex: 0 0 75% !important;
    max-width: 75% !important;
}

/* Button Styles */
.btn {
    transition: all 0.2s ease-in-out;
    font-family: 'Inter', inherit;
    font-weight: 500;
    letter-spacing: .2px;
}

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

/* Custom Alert Styles */
.alert-custom {
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Enhanced Marker Pin Styles */
.marker-pin {
    position: relative;
    width: 40px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Removed translateY transform to position pin exactly at click */
}

.start-pin {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    animation: pinDrop 0.4s ease-out;
}

.end-pin {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
    animation: pinDrop 0.4s ease-out;
}

.marker-icon {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

/* Pulsing Animation for Markers */
.marker-pulse {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    animation: pulse 1.5s infinite; /* Faster pulse */
}

.start-pulse {
    background-color: rgba(34, 197, 94, 0.6);
}

.end-pulse {
    background-color: rgba(220, 38, 38, 0.6);
}

/* Pin Drop Animation */
@keyframes pinDrop {
    0% {
        transform: translateY(-50px) scale(0.3);
        opacity: 0;
    }
    60% {
        transform: translateY(5px) scale(1.1);
        opacity: 0.9;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.8);
        opacity: 0.2;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Route Animation Styles */
.animated-route {
    animation: routeGlow 3s ease-in-out infinite alternate;
}

.route-complete {
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.6));
}

@keyframes routeGlow {
    0% {
        filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.4));
    }
    100% {
        filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.8));
    }
}

/* Comparison Route Styles */
.dijkstra-route {
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.5));
}

.astar-route {
    filter: drop-shadow(0 0 6px rgba(220, 38, 38, 0.5));
}

/* Enhanced Popup Styles */
.marker-popup {
    text-align: center;
    font-family: 'Segoe UI', sans-serif;
    border-radius: 8px;
    padding: 8px;
}

.start-popup {
    border-left: 4px solid #22c55e;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.end-popup {
    border-left: 4px solid #dc2626;
    background: linear-gradient(135deg, #fef2f2, #fecaca);
}

.route-popup {
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dijkstra-popup {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.astar-popup {
    border-left: 4px solid #dc2626;
    background: linear-gradient(135deg, #fef2f2, #fecaca);
}

/* Selection Status Styles */
#selectionStatus {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e9ecef;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    font-size: 0.8rem;
}

/* Route Info Styles */
#routeInfo {
    background: linear-gradient(135deg, #e7f3ff, #bfdbfe);
    padding: 0.75rem;
    border-radius: 0.5rem;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.1);
    font-size: 0.8rem;
}

/* Enhanced Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
    transition: all 0.3s ease;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,123,255,0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #545b62);
    border: none;
    box-shadow: 0 2px 8px rgba(108,117,125,0.3);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    border: none;
    box-shadow: 0 2px 8px rgba(23,162,184,0.3);
}

/* Loading Animation Enhancement */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    animation: spin 1s linear infinite;
}

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

/* Enhanced marker positioning */
.custom-marker {
    background: none;
    border: none;
}

.custom-marker div {
    position: relative;
}

/* Simple circular markers */
.simple-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 2px solid white;
    animation: markerDrop 0.3s ease-out;
}

.start-marker-circle {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.end-marker-circle {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.marker-inner {
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Marker drop animation */
@keyframes markerDrop {
    0% {
        transform: translateY(-20px) scale(0.3);
        opacity: 0;
    }
    60% {
        transform: translateY(2px) scale(1.1);
        opacity: 0.9;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .col-md-3 {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1000;
        width: 100%;
        max-height: 50vh;
        background-color: rgba(248, 249, 250, 0.95);
        backdrop-filter: blur(10px);
    }

    .col-md-9 {
        padding-top: 50vh;
    }

    #map {
        height: 50vh !important;
        margin-top: 50vh;
    }

    .marker-pin {
        width: 32px;
        height: 40px;
    }

    .gauge-row {
        gap: 8px;
    }

    .gauge-container {
        flex: 1 1 48%;
        max-width: 48%;
        min-width: 120px;
    }
}

/* Smooth transitions for all interactive elements */
* {
    transition: all 0.2s ease-in-out;
}

/* Modern heading hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', inherit;
    font-weight: 600;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-top: 0.75rem;
}

h5, h6 { font-weight: 600; }

/* Refine card header typography */
.card-header h6, .card-header h5 { margin: 0; font-weight: 600; }

/* Small text readability */
small, .small { font-size: 0.78rem; letter-spacing: .15px; }

/* Metric labels subtle tone */
.metric-label { font-weight: 500; letter-spacing: .15px; }
.metric-value { letter-spacing: .15px; }

/* Legend & gauge labels */
.gauge-label, .mini-legend, .chart-title { font-family: 'Inter', inherit; letter-spacing: .3px; }

/* Footer refinement */
.credit-footer { font-family: 'Inter', inherit; letter-spacing: .25px; }

/* Footer Styles */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: #212529 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 0 !important;
    height: 40px !important; /* Reduced height */
}

.footer .container-fluid {
    height: auto;
}

.footer p,
.footer p *,
.footer small,
.footer small *,
.footer span,
.footer a {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.7rem !important; /* Smaller text */
    color: #ffffff !important;
    line-height: 1.2 !important;
}

.footer a,
.footer a.text-info,
.footer .text-info {
    color: #17a2b8 !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

.footer a:hover,
.footer a.text-info:hover,
.footer .text-info:hover {
    color: #0dcaf0 !important;
    text-decoration: underline !important;
}

.footer .fab.fa-linkedin {
    margin-right: 3px;
    color: #17a2b8 !important;
    font-size: 0.7rem !important;
}

/* Ensure footer content is centered and visible */
.footer .row,
.footer .col-12 {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
}

.footer .col-12 p {
    display: inline-block;
    margin: 0 10px !important;
}

/* Credit Footer Styles */
.credit-footer {
    position: fixed;
    bottom: 6px;
    left: 8px;
    font-size: 11px;
    background: rgba(15, 23, 42, 0.75);
    color: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
    z-index: 1200;
    font-family: 'Segoe UI', sans-serif;
    backdrop-filter: blur(4px);
    line-height: 1.1;
}

.credit-footer a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
}

.credit-footer a:hover {
    text-decoration: underline;
    color: #a78bfa;
}

.credit-footer .heart {
    color: #ef4444;
    display: inline-block;
    animation: pulseHeart 1.8s infinite ease-in-out;
}

/* Animation for complexity visualization */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

.performance-metric-card {
    animation: fadeInUp 0.6s ease-out;
}

.efficiency-bar {
    animation: expandWidth 1.5s ease-out;
}

@keyframes expandWidth {
    from { width: 0; }
    to { width: var(--final-width); }
}

/* Responsive Design for Analytics */
@media (max-width: 768px) {
    .chart-container {
        height: 150px;
        padding: 0.5rem;
    }

    .chart-bars {
        height: 100px;
    }

    .chart-bar {
        width: 20px;
    }

    .performance-metric-card {
        flex-direction: column;
        text-align: center;
    }

    .metric-icon {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .efficiency-row {
        flex-direction: column;
        align-items: stretch;
    }

    .size-label {
        width: auto;
        margin-bottom: 0.5rem;
        text-align: center;
    }
}

/* Sidebar Complexity Analysis Styles */
.algorithm-complexity {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.complexity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
}

.dijkstra-item {
    background: linear-gradient(135deg, #e7f3ff, #cce7ff);
    border-left: 3px solid #007bff;
}

.astar-item {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-left: 3px solid #dc3545;
}

/* Added bidirectional violet styling */
.bidirectional-item {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    border-left: 3px solid #8b5cf6;
}

.algorithm-name {
    font-weight: 600;
    color: #495057;
}

.complexity-formula {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6c757d;
}

/* Mini Chart Styles for Sidebar */
.mini-chart {
    background: #f8f9fa;
    border-radius: 0.375rem;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
}

.chart-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.5rem;
    color: #495057;
}

.mini-bars {
    display: flex;
    justify-content: space-around;
    align-items: end;
    height: 60px;
    margin-bottom: 0.5rem;
}

.mini-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mini-bar {
    width: 12px;
    min-height: 2px;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.dijkstra-mini {
    background: linear-gradient(to top, #007bff, #0056b3);
}

.astar-mini {
    background: linear-gradient(to top, #dc3545, #b02a37);
}

.bar-label {
    font-size: 0.65rem;
    color: #6c757d;
    margin-top: 2px;
}

.mini-legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-size: 0.7rem;
    color: #6c757d;
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.dijkstra-dot {
    background: #007bff;
}

.astar-dot {
    background: #dc3545;
}

/* Added missing bidirectional legend dot */
.bidirectional-dot {
    background: #8b5cf6;
}

/* Performance Metrics Styles */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid #f1f3f4;
    font-size: 0.8rem;
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-label {
    color: #6c757d;
    font-weight: 500;
}

.metric-value {
    font-weight: 600;
    color: #495057;
}

/* Animation for sidebar complexity display */
#complexityDisplay,
#performanceDisplay {
    animation: slideInFromTop 0.4s ease-out;
}

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

/* Mini Visual Charts and Gauges Styles */
.mini-visual-charts {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem 0.75rem;
}

.mini-visual-charts .chart-title {
    font-size: 0.7rem;
    letter-spacing: .5px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.gauge-row {
    display: flex;
    justify-content: center; /* center gauges and avoid edge clipping */
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.gauge-container {
    position: relative;
    flex: 1 1 110px; /* grow/shrink with min basis */
    min-width: 96px;
    max-width: 140px;
    text-align: center;
}

.gauge-container canvas {
    display: block; /* remove inline whitespace */
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    background: radial-gradient(circle at 50% 55%, #ffffff 0%, #f1f5f9 70%);
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05),0 1px 2px rgba(0,0,0,0.06);
}

/* Contain any overflow just in case */
.mini-visual-charts { overflow: hidden; }

/* PathFinder - Custom Styles */
.app-logo {
    width: 28px;
    height: 28px;
    display: inline-block;
    object-fit: contain;
    border-radius: 6px; /* subtle rounding */
    box-shadow: 0 0 4px rgba(0,0,0,0.25);
}

.app-logo-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.app-logo-wrapper svg {
    width: 28px;
    height: 28px;
    display: block;
}

/* Overview / Welcome Modal Enhancements */
.overview-modal .modal-content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(2, 6, 23, 0.35);
}
.overview-modal .modal-header {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    border-bottom: none;
}
.overview-modal .modal-title {
    font-weight: 700;
    letter-spacing: -0.3px;
}
.overview-modal .modal-title .fa-route { color: #fff; opacity: 0.95; }
.overview-modal .btn-close { filter: invert(1) grayscale(1) brightness(2); }
.overview-modal .modal-body {
    background:
      radial-gradient(1200px 400px at 100% -50%, rgba(59,130,246,.08), rgba(0,0,0,0) 60%),
      radial-gradient(1000px 400px at -30% 0%, rgba(139,92,246,.08), rgba(0,0,0,0) 60%),
      #ffffff;
}
.overview-modal .modal-body p { font-size: 0.98rem; }
.overview-modal .modal-body ul {
    margin: 0 0 0.25rem 0;
    padding: 0;
    list-style: none;
}
.overview-modal .modal-body li {
    position: relative;
    padding-left: 28px;
    margin: 8px 0;
}
.overview-modal .modal-body li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 2px 6px rgba(22,163,74,0.35);
}
.overview-modal .modal-footer {
    background: #f8fafc;
    border-top: 1px solid #eef2f7;
}
.overview-modal .btn.btn-primary {
    padding: 0.5rem 1rem;
    border-radius: 10px;
}
