@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    background: #0a0a0f;
}

:root {
    --purple: #8b5cf6;
    --pink: #ec4899;
}

body {
    background: linear-gradient(135deg, #0a0a0f, #1a0e2e, #0a0a0f, #1a0e2e);
    background-size: 400% 400%;
    background-attachment: fixed;
    min-height: 100vh;
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    color: white;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    animation: backgroundMove 15s ease infinite;
}

@keyframes backgroundMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Borda Animada no Topo */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #8b5cf6, #ec4899, #8b5cf6, #ec4899);
    background-size: 200% 100%;
    animation: gradientMove 3s ease infinite;
    z-index: 9999;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(1px 1px at 60% 70%, white, transparent);
    background-size: 300% 300%;
    animation: stars 200s linear infinite;
    opacity: 0.4;
    z-index: 0;
}

@keyframes stars {
    to { background-position: -300% 0; }
}

.glow-1, .glow-2 {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.glow-1 {
    width: 600px;
    height: 600px;
    background: var(--purple);
    top: -300px;
    left: -300px;
}

.glow-2 {
    width: 500px;
    height: 500px;
    background: var(--pink);
    bottom: -250px;
    right: -250px;
}

.container {
    position: relative;
    z-index: 1;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo {
    max-width: 250px;
    margin-bottom: 50px;
    filter: drop-shadow(0 10px 30px rgba(139, 92, 246, 0.5));
}

h1 {
    font-size: clamp(32px, 7vw, 48px);
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 8px;
}

/* Fallback para navegadores antigos sem suporte a clamp */
@supports not (font-size: clamp(32px, 7vw, 48px)) {
    h1 { font-size: 40px; }
}

.subtitle {
    text-align: center;
    font-size: 16px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 40px;
}

.form-box {
    width: 100%;
    max-width: 500px;
}

input[type="text"] {
    width: 100%;
    padding: 20px;
    font-size: 20px;
    text-align: center;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(139,92,246,0.3);
    border-radius: 16px;
    color: white;
    margin-bottom: 16px;
    font-family: 'Space Grotesk', sans-serif;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 30px rgba(139,92,246,0.3);
}

input[type="text"]::placeholder {
    color: rgba(255,255,255,0.4);
}

button[type="submit"], .btn-calculate {
    width: 100%;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border: none;
    border-radius: 16px;
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(139,92,246,0.4);
    transition: transform 0.3s;
}

button[type="submit"]:hover, .btn-calculate:hover {
    transform: translateY(-3px);
}

.alert-origin {
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.3);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-remove {
    padding: 6px 12px;
    background: rgba(239,68,68,0.2);
    border: 1px solid rgba(239,68,68,0.4);
    border-radius: 8px;
    color: #fca5a5;
    text-decoration: none !important;
}

.alert-success {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.3);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    margin: 30px auto;
    max-width: 600px;
    color: #86efac;
}

.alert-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin: 30px auto;
    max-width: 600px;
    color: #fca5a5;
    line-height: 1.6;
}

/* Loading State */
.loading-container {
    text-align: center;
    padding: 60px 20px;
    margin: 40px auto;
    max-width: 500px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid rgba(139, 92, 246, 0.2);
    border-top: 4px solid var(--purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 40px 0;
    max-width: 1200px;
    width: 100%;
}

/* Fallback para navegadores sem grid */
@supports not (display: grid) {
    .results-grid {
        display: flex;
        flex-wrap: wrap;
    }
    .freight-card {
        flex: 1 1 300px;
        margin: 12px;
    }
}

.freight-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
    text-decoration: none !important;
    color: white;
    display: block;
    cursor: pointer;
}

.freight-card:hover {
    transform: translateY(-8px);
    border-color: var(--purple);
    box-shadow: 0 20px 40px rgba(139,92,246,0.3);
    text-decoration: none !important;
}

.freight-card img {
    max-width: 120px;
    margin-bottom: 16px;
}

.freight-card h3 {
    font-size: 24px;
    margin-bottom: 8px;
    text-decoration: none !important;
}

.freight-card .delivery-time {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 16px;
}

.freight-card .price {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin: 16px 0;
}

.badge {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.badge-success {
    background: rgba(34,197,94,0.2);
    color: #86efac;
}

.badge-warning {
    background: rgba(251,191,36,0.2);
    color: #fde047;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 50px auto;
    max-width: 800px;
    width: 100%;
}

.btn-action {
    padding: 18px 30px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none !important;
    border-radius: 12px;
    transition: all 0.3s;
}

.btn-track {
    background: rgba(34,197,94,0.2);
    border: 1px solid rgba(34,197,94,0.4);
    color: #86efac;
}

.btn-whatsapp {
    background: rgba(37,211,102,0.2);
    border: 1px solid rgba(37,211,102,0.4);
    color: #86efac;
}

.btn-share {
    background: rgba(236,72,153,0.2);
    border: 1px solid rgba(236,72,153,0.4);
    color: #f9a8d4;
    cursor: pointer;
}

.btn-track:hover, .btn-whatsapp:hover, .btn-share:hover {
    transform: translateY(-3px);
}

/* Tablets e iPads */
@media (max-width: 1024px) and (min-width: 769px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .container {
        padding: 30px 20px;
    }
}

/* Tablets pequenos e celulares grandes */
@media (max-width: 768px) {
    .results-grid { 
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .logo { max-width: 200px; }
    .container {
        padding: 20px 15px;
    }
    .freight-card {
        padding: 25px;
    }
    .action-buttons {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Celulares pequenos */
@media (max-width: 480px) {
    .logo {
        max-width: 180px;
        margin-bottom: 30px;
    }
    h1 {
        font-size: 28px;
    }
    .subtitle {
        font-size: 14px;
    }
    input[type="text"] {
        padding: 16px;
        font-size: 18px;
    }
    button[type="submit"] {
        padding: 16px;
        font-size: 16px;
    }
    .freight-card {
        padding: 20px;
    }
    .freight-card .price {
        font-size: 32px;
    }
    .freight-card h3 {
        font-size: 20px;
    }
}

/* Celulares muito pequenos */
@media (max-width: 360px) {
    .container {
        padding: 15px 10px;
    }
    .results-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .freight-card {
        padding: 15px;
    }
    h1 {
        font-size: 24px;
    }
    .badge {
        font-size: 11px;
        padding: 8px 14px;
    }
}

/* Modal de Rastreamento */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

/* Fallback para navegadores sem backdrop-filter */
@supports not (backdrop-filter: blur(10px)) {
    .modal {
        background-color: rgba(0, 0, 0, 0.92);
    }
}

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

.modal-content {
    background: linear-gradient(135deg, rgba(26, 14, 46, 0.95), rgba(10, 10, 15, 0.95));
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 24px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.3);
    animation: slideUp 0.3s;
}

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

.modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 32px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
}

.modal-close:hover {
    color: var(--pink);
}

.modal-icon {
    font-size: 64px;
    text-align: center;
    margin-bottom: 20px;
}

.modal-icon.success {
    color: #86efac;
}

.modal-icon.warning {
    color: #fde047;
}

#modalBody h2 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.modal-description {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.6;
}

.modal-list {
    list-style: none;
    margin-bottom: 30px;
}

.modal-list li {
    padding: 12px 20px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid var(--purple);
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.5;
    transition: all 0.3s;
}

.modal-list li:hover {
    background: rgba(139, 92, 246, 0.1);
    transform: translateX(5px);
}

.modal-list li.modal-yes {
    color: #86efac;
    border-left-color: #22c55e;
    border-left-width: 4px;
}

.modal-list li.modal-no {
    color: #fca5a5;
    border-left-color: #ef4444;
    border-left-width: 4px;
}

.modal-note {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.modal-note strong {
    color: var(--purple);
}

/* Adicionar cursor pointer nos badges */
.badge {
    cursor: pointer;
    transition: all 0.3s;
}

.badge:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3);
}

/* Modal responsivo para tablets */
@media (max-width: 768px) {
    .modal-content {
        padding: 30px 20px;
        width: 95%;
        max-height: 85vh;
    }
    
    #modalBody h2 {
        font-size: 24px;
    }
    
    .modal-icon {
        font-size: 48px;
    }
    
    .modal-list li {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Modal para celulares pequenos */
@media (max-width: 480px) {
    .modal-content {
        padding: 25px 15px;
        width: 98%;
        border-radius: 16px;
    }
    
    #modalBody h2 {
        font-size: 20px;
    }
    
    .modal-icon {
        font-size: 40px;
    }
    
    .modal-description {
        font-size: 14px;
    }
    
    .modal-note {
        padding: 15px;
        font-size: 14px;
    }
    
    .modal-close {
        font-size: 28px;
        top: 15px;
        right: 15px;
    }
}
