:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-main: #f1f5f9;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --white: #ffffff;
    --border: #e2e8f0;
    --success: #10b981;
    --radius: 16px;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: linear-gradient(-45deg, #0f172a, #1e293b, #2563eb, #1e3a8a);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic Viewport for mobile */
    padding: calc(3rem + var(--safe-top)) 1rem calc(2rem + var(--safe-bottom));
}

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

.portal-container {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    .portal-container:hover {
        transform: translateY(-5px);
    }
}

.portal-header {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    color: var(--primary);
    width: 32px;
    height: 32px;
}

.portal-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.portal-header p {
    color: #94a3b8;
    font-size: 0.875rem;
}

.portal-content {
    padding: 2rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f1f5f9;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
}

input, textarea, select {
    padding: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    outline: none;
    font-size: 16px; /* iOS Auto-zoom Fix (Must be 16px min) */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), inset 0 2px 4px 0 rgba(0, 0, 0, 0.01);
    transform: translateY(-2px);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.125rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.025em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3), 0 2px 4px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4), 0 4px 6px -2px rgba(37, 99, 235, 0.2);
}

.btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn i {
    pointer-events: none;
}

.spin {
    animation: spin 1s linear infinite;
}

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

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.portal-footer {
    text-align: center;
    padding: 1.5rem;
    background: rgba(248, 250, 252, 0.5);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Success Card */
.success-card {
    text-align: center;
    padding: 2rem 1rem;
}

.success-icon {
    width: 64px;
    height: 64px;
    background: #ecfdf5;
    color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.success-icon i {
    width: 32px;
    height: 32px;
}

.success-card h2 {
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.success-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.tracking-number {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tracking-number span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tracking-number strong {
    font-size: 1.25rem;
    color: var(--primary);
    letter-spacing: 1px;
}

.copy-btn {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
    border: 1.5px dashed var(--primary);
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    width: fit-content;
    align-self: center;
    white-space: nowrap;
}

.copy-btn.success-btn {
    background: #ecfdf5 !important;
    color: #10b981 !important;
    border-color: #10b981 !important;
    border-style: solid !important;
}

.copy-btn:active {
    transform: scale(0.95);
    background: var(--primary);
    color: white;
}

@media (max-width: 480px) {
    body {
        padding: 0;
        align-items: stretch;
    }
    .portal-container {
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    .portal-content {
        flex: 1;
    }
}
