/* Premium Insurance Pre-loader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #fff5f5 50%, #fffbf0 100%);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
    position: relative;
}

/* Shield Logo Container */
.shield-container {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 40px;
}

/* Animated Shield */
.shield {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 110px;
}

.shield-bg {
    fill: #f8f9fa;
    opacity: 0;
    animation: fadeInShield 0.8s ease-out forwards;
}

.shield-outline {
    fill: none;
    stroke: #ED0B16;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    animation: drawShield 2.5s ease-in-out forwards;
}

.shield-inner {
    fill: none;
    stroke: #eec125;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawShieldInner 2s ease-in-out 0.3s forwards;
}

/* Checkmark */
.checkmark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 50px;
    height: 50px;
    animation: scaleIn 0.5s ease-out 1.5s forwards;
}

.checkmark-circle {
    fill: #ED0B16;
    opacity: 0;
    animation: fadeIn 0.3s ease-out 1.5s forwards;
}

.checkmark-path {
    fill: none;
    stroke: #ffffff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: drawCheck 0.6s ease-out 1.7s forwards;
}

/* Elegant Rotating Ring */
.circle-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
}

.orbit-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-top-color: #ED0B16;
    border-right-color: #ED0B16;
    border-radius: 50%;
    animation: rotateRing 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    opacity: 0.6;
}

.orbit-ring:nth-child(2) {
    width: 120px;
    height: 120px;
    top: 10px;
    left: 10px;
    border-top-color: #eec125;
    border-right-color: #eec125;
    animation: rotateRing 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}

.orbit-dots {
    position: absolute;
    width: 100%;
    height: 100%;
    animation: rotateRing 3s linear infinite;
}

.orbit-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ED0B16, #eec125);
    box-shadow: 0 0 12px rgba(237, 11, 22, 0.5);
}

.orbit-dot:nth-child(1) {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.orbit-dot:nth-child(2) {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

.orbit-dot:nth-child(3) {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.orbit-dot:nth-child(4) {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

/* Loading Text */
.loading-text {
    color: #2d3748;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 10px;
    opacity: 0;
    animation: fadeInText 0.5s ease-out 0.5s forwards;
}

.loading-dots {
    display: inline-block;
    width: 20px;
    text-align: left;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

/* Elegant Progress Bar */
.progress-container {
    width: 240px;
    height: 3px;
    background: #e5e7eb;
    border-radius: 10px;
    margin: 25px auto 0;
    overflow: hidden;
    opacity: 0;
    animation: fadeInText 0.5s ease-out 0.7s forwards;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ED0B16, #eec125);
    border-radius: 10px;
    width: 0%;
    animation: loadingProgress 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    box-shadow: 0 0 10px rgba(237, 11, 22, 0.4);
}

/* Brand Text */
.brand-text {
    color: #718096;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1.5px;
    margin-top: 15px;
    opacity: 0;
    animation: fadeInText 0.5s ease-out 0.9s forwards;
}

/* Animations */
@keyframes drawShield {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes drawShieldInner {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes fadeInShield {
    to {
        opacity: 1;
    }
}

@keyframes drawCheck {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes scaleIn {
    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes fadeInText {
    to {
        opacity: 1;
    }
}

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

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

@keyframes loadingProgress {
    0% {
        width: 0%;
        opacity: 1;
    }
    70% {
        width: 90%;
        opacity: 1;
    }
    100% {
        width: 100%;
        opacity: 0.8;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .shield-container {
        width: 140px;
        height: 140px;
        margin: 0 auto 30px;
    }
    
    .shield {
        width: 85px;
        height: 95px;
    }
    
    .checkmark {
        width: 42px;
        height: 42px;
    }
    
    .circle-orbit {
        width: 120px;
        height: 120px;
    }
    
    .orbit-ring:nth-child(2) {
        width: 100px;
        height: 100px;
    }
    
    .loading-text {
        font-size: 16px;
    }
    
    .progress-container {
        width: 200px;
    }
    
    .brand-text {
        font-size: 12px;
    }
}
