.tile {
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}
.tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.mechanical-tile {
    --gradient-start: #60a5fa;
    --gradient-end: #3b82f6;
}
.electrical-tile {
    --gradient-start: #f472b6;
    --gradient-end: #ec4899;
}
.computer-tile {
    --gradient-start: #34d399;
    --gradient-end: #10b981;
}
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    z-index: 50;
    opacity: 0;
    transition: background-color 0.3s ease, opacity 0.3s ease;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    overflow-y: auto; /* Allow scrolling inside modal */
}
.modal.active {
    display: flex;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 1;
}
.modal-content {
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    width: 100%;
    max-width: 64rem; /* 4xl */
    margin: auto;
    max-height: 90vh; /* Ensures scrolling */
    overflow-y: auto; /* Ensures content inside modal is scrollable */
}
.modal.active .modal-content {
    transform: scale(1);
    opacity: 1;
}
.glass-effect {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.unit-card {
    transition: all 0.3s ease;
    cursor: pointer;
    transform: translateY(20px);
    opacity: 0;
}
.modal.active .unit-card {
    transform: translateY(0);
    opacity: 1;
}
.modal.active .unit-card:nth-child(1) { transition-delay: 0.1s; }
.modal.active .unit-card:nth-child(2) { transition-delay: 0.2s; }
.modal.active .unit-card:nth-child(3) { transition-delay: 0.3s; }
.modal.active .unit-card:nth-child(4) { transition-delay: 0.4s; }

.unit-card:hover {
    transform: translateY(-2px) scale(1.02);
}
.mechanical-gradient {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}
.electrical-gradient {
    background: linear-gradient(135deg, #f472b6, #ec4899);
}
.computer-gradient {
    background: linear-gradient(135deg, #34d399, #10b981);
}
.unit-modal {
    /* background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end)); */
    background: linear-gradient(#fc6d2f, #f84857);
}

/* Close button animation */
.close-btn {
    transition: all 0.3s ease;
}
.close-btn:hover {
    transform: rotate(90deg);
}

/* Fade out animation */
.modal.closing {
    animation: fadeOut 0.3s ease forwards;
}

.modal.active {
    animation: fadeIn 0.3s ease forwards;
}
.modal.closing .modal-content {
    animation: scaleDown 0.3s ease forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleDown {
    from { 
        transform: scale(1);
        opacity: 1;
    }
    to { 
        transform: scale(0.95);
        opacity: 0;
    }
}