/* ===== Modern Rounded UI with Premium Animations ===== */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --glass-bg: rgba(17, 25, 40, 0.75);
    --glass-border: rgba(255, 255, 255, 0.125);
    --border-radius-sm: 12px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --border-radius-xl: 32px;

    /* Professional Animation Curves */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out-circ: cubic-bezier(0.85, 0, 0.15, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* Refined Timing */
    --transition-instant: 0.15s;
    --transition-fast: 0.25s;
    --transition-normal: 0.35s;
    --transition-slow: 0.5s;
    --transition-slower: 0.7s;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== Glass Panel System ===== */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all var(--transition-normal);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ===== Modern Button System ===== */
.btn-modern {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-sm) !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px;
    transition: all var(--transition-normal) var(--ease-out-expo);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

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

.btn-modern:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.25),
        0 0 20px rgba(59, 130, 246, 0.3);
}

.btn-modern:active {
    transform: translateY(0) scale(0.99);
    transition: all var(--transition-instant) var(--ease-in-out-circ);
}

/* Button Variants */
.btn-modern.is-info {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
}

.btn-modern.is-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.btn-modern.is-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-modern.is-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 30px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(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 scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.fade-in-up {
    animation: fadeInUp var(--transition-slow) ease-out forwards;
}

.fade-in {
    animation: fadeIn var(--transition-normal) ease-out forwards;
}

.slide-in-right {
    animation: slideInRight var(--transition-normal) ease-out forwards;
}

.slide-in-left {
    animation: slideInLeft var(--transition-normal) ease-out forwards;
}

.scale-in {
    animation: scaleIn var(--transition-normal) ease-out forwards;
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ===== Parking Markers ===== */
.parking-marker {
    position: absolute;
    transform: translate(-50%, -100%);
    cursor: pointer;
    transition: all var(--transition-normal);
    z-index: 100;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.parking-marker:hover {
    transform: translate(-50%, -110%) scale(1.15);
    filter: drop-shadow(0 8px 24px rgba(59, 130, 246, 0.6));
    animation: pulse 1.5s ease-in-out infinite;
}

.parking-marker.selected {
    animation: pulse 2s ease-in-out infinite;
}

.parking-marker.selected .parking-marker-icon rect {
    fill: var(--success-color);
    stroke: #fff;
    stroke-width: 2;
}

.parking-marker-label {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: all var(--transition-fast);
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.parking-marker:hover .parking-marker-label {
    opacity: 1;
    top: -35px;
}

/* ===== Autopark Controls ===== */
#autopark-controls {
    animation: fadeInUp 0.6s ease-out forwards;
}

#autopark-status {
    animation: fadeIn 0.4s ease-out forwards;
}

/* ===== Dashboard Elements ===== */
.gui-box {
    border-radius: var(--border-radius-md) !important;
    transition: all var(--transition-normal);
    animation: fadeIn 0.5s ease-out forwards;
}

.gui-box:hover {
    transform: translateY(-2px);
}

.sim-mode-box {
    animation: slideInDown 0.6s ease-out forwards;
}

.edit-mode-box {
    animation: slideInUp 0.6s ease-out forwards;
}

/* Stagger animations for multiple elements */
.gui-box:nth-child(1) {
    animation-delay: 0s;
}

.gui-box:nth-child(2) {
    animation-delay: 0.1s;
}

.gui-box:nth-child(3) {
    animation-delay: 0.2s;
}

.gui-box:nth-child(4) {
    animation-delay: 0.3s;
}

.gui-box:nth-child(5) {
    animation-delay: 0.4s;
}

/* ===== Control Panel Enhancements ===== */
#controls {
    position: relative;
}

#wheel {
    transition: transform var(--transition-fast);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

#wheel:hover {
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.3));
}

/* ===== Stats Display ===== */
.heading {
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.7rem;
}

#stats .column {
    animation: slideInDown 0.5s ease-out forwards;
    opacity: 0;
}

#stats .column:nth-child(1) {
    animation-delay: 0.1s;
}

#stats .column:nth-child(2) {
    animation-delay: 0.2s;
}

#stats .column:nth-child(3) {
    animation-delay: 0.3s;
}

#stats .column:nth-child(4) {
    animation-delay: 0.4s;
}

#stats .column:nth-child(5) {
    animation-delay: 0.5s;
}

/* ===== Modal Enhancements ===== */
.modal.is-active {
    animation: fadeIn 0.3s ease-out forwards;
}

.modal.is-active .modal-background {
    animation: fadeIn 0.3s ease-out forwards;
}

.modal.is-active .modal-content {
    animation: zoomIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.modal-box {
    border-radius: var(--border-radius-lg) !important;
    animation: slideInDown 0.5s ease-out forwards;
}

.modal-background {
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out forwards;
}

/* ===== Welcome Modal Enhancements ===== */
#welcome-modal .hero {
    animation: slideInDown 0.6s ease-out forwards;
}

#welcome-modal p {
    animation: fadeIn 0.8s ease-out forwards;
    opacity: 0;
}

#welcome-modal p:nth-of-type(1) {
    animation-delay: 0.2s;
}

#welcome-modal p:nth-of-type(2) {
    animation-delay: 0.3s;
}

#welcome-modal p:nth-of-type(3) {
    animation-delay: 0.4s;
}

#welcome-modal p:nth-of-type(4) {
    animation-delay: 0.5s;
}

/* ===== Button Groups ===== */
.buttons.has-addons .button {
    border-radius: 0 !important;
    transition: all var(--transition-fast);
}

.buttons.has-addons .button:first-child {
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm) !important;
}

.buttons.has-addons .button:last-child {
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0 !important;
}

.buttons.has-addons .button:hover {
    transform: scale(1.05);
    z-index: 1;
}

/* ===== Button Enhancements ===== */
.button {
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

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

.button:hover::after {
    width: 300px;
    height: 300px;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.button:active {
    transform: translateY(0);
}

.button.is-dark.is-outlined.is-inverted:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.button.is-primary:hover,
.button.is-info:hover,
.button.is-success:hover {
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 0 30px currentColor;
}

/* ===== Input Fields ===== */
.input,
.textarea {
    border-radius: var(--border-radius-sm) !important;
    transition: all var(--transition-fast);
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
}

.input:focus,
.textarea:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
    transform: scale(1.01);
}

/* ===== Scenario Cards ===== */
.column {
    position: relative;
    transition: all var(--transition-normal);
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
}

/* Stagger scenario cards */
.column:nth-child(1) {
    animation-delay: 0.1s;
}

.column:nth-child(2) {
    animation-delay: 0.2s;
}

.column:nth-child(3) {
    animation-delay: 0.3s;
}

.column:nth-child(4) {
    animation-delay: 0.4s;
}

.column:nth-child(5) {
    animation-delay: 0.5s;
}

.column:nth-child(6) {
    animation-delay: 0.6s;
}

.column:nth-child(7) {
    animation-delay: 0.7s;
}

.column:nth-child(8) {
    animation-delay: 0.8s;
}

.column:hover {
    transform: translateY(-8px) scale(1.03);
    z-index: 10;
    transition: all var(--transition-normal) var(--ease-out-back);
}

.column img {
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-normal);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.column:hover img {
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(59, 130, 246, 0.3);
    filter: brightness(1.15) saturate(1.2);
}

.column[data-severity="critical"]:hover {
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.column[data-severity="high"]:hover {
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

.column[data-severity="medium"]:hover {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

/* ===== FSD Scenario Badges & Sources ===== */
.fsd-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: bounceIn 0.6s ease-out;
}

.fsd-badge.is-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.fsd-badge.is-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.fsd-badge.is-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.fsd-badge.is-light {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.fsd-source {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 4px;
    font-style: italic;
}

/* ===== Config Panel Animations ===== */
#config-box-content {
    animation: slideInDown 0.4s ease-out forwards;
}

#config-form .field {
    animation: slideInLeft 0.5s ease-out forwards;
    opacity: 0;
}

#config-form .field:nth-child(1) {
    animation-delay: 0.1s;
}

#config-form .field:nth-child(2) {
    animation-delay: 0.2s;
}

#config-form .field:nth-child(3) {
    animation-delay: 0.3s;
}

#config-form .field:nth-child(4) {
    animation-delay: 0.4s;
}

#config-form .field:nth-child(5) {
    animation-delay: 0.5s;
}

/* ===== Icon Animations ===== */
.icon {
    transition: all var(--transition-fast);
}

.icon:hover {
    transform: scale(1.2) rotate(5deg);
}

.fa-cog:hover {
    animation: rotate 1s linear infinite;
}

.fa-info:hover {
    animation: pulse 1s ease-in-out infinite;
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* ===== Tab Animations ===== */
.tabs li {
    transition: all var(--transition-normal);
}

.tabs li:hover {
    transform: translateY(-2px);
}

.tabs li.is-active {
    animation: bounceIn 0.5s ease-out forwards;
}

/* ===== Delete Button Enhancement ===== */
.delete {
    transition: all var(--transition-fast);
}

.delete:hover {
    transform: rotate(90deg) scale(1.2);
    background: rgba(239, 68, 68, 0.8);
}

/* ===== Tag Enhancements ===== */
.tag {
    transition: all var(--transition-fast);
    animation: bounceIn 0.5s ease-out forwards;
}

.tag:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ===== Notification Animations ===== */
.notification {
    animation: slideInRight 0.4s ease-out forwards;
}

/* ===== Loading States ===== */
.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ===== Glow Effects ===== */
.glow {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    }

    50% {
        box-shadow: 0 0 40px rgba(59, 130, 246, 0.8);
    }
}

/* ===== Smooth Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: all var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== Status Indicators ===== */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.active {
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}

.status-indicator.warning {
    background: var(--warning-color);
    box-shadow: 0 0 10px var(--warning-color);
}

.status-indicator.error {
    background: var(--danger-color);
    box-shadow: 0 0 10px var(--danger-color);
}

/* ===== Tooltip System ===== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-fast);
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px);
}

/* ===== Smooth Page Transitions ===== */
body {
    animation: fadeIn 0.5s ease-out forwards;
}

/* ===== Accessibility: Respect reduced motion ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}