@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --roo-dark: #050508;
    --roo-surface: rgba(12, 10, 14, 0.72);
    --roo-surface-solid: #0c0a0e;
    --roo-border: rgba(255, 255, 255, 0.08);
    --roo-border-glow: rgba(255, 23, 68, 0.35);
    --roo-red: #ff1744;
    --roo-red-dark: #c62828;
    --roo-fire: #ff6b35;
    --roo-gold: #ffb347;
    --roo-text: #f5f7fb;
    --roo-text-dim: #a8b0c2;
    --roo-success: #10b981;
    --glass-blur: blur(22px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: var(--roo-text);
    min-height: 100vh;
    background: #050508;
    overflow-x: hidden;
}

/* ===== CINEMATIC BACKGROUND ===== */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #050508 url('/static/img/bg-main.jpg') center center / cover no-repeat;
    transform: scale(1.03);
}

.ambient-vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0.82) 100%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(20, 0, 0, 0.45) 50%, rgba(0, 0, 0, 0.75) 100%);
    pointer-events: none;
}

.ambient-glow {
    position: fixed;
    inset: 0;
    z-index: 2;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 23, 68, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 80% 70%, rgba(255, 107, 53, 0.1) 0%, transparent 40%);
    pointer-events: none;
    animation: glowPulse 8s ease-in-out infinite alternate;
}

@keyframes glowPulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* ===== FLYING BATS + CAIXA BOX ===== */
.bat-layer {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    overflow: hidden;
}

.flying-bat {
    position: absolute;
    left: 0;
    top: var(--top);
    animation: batFlyLeft var(--duration) linear infinite;
    animation-delay: var(--delay);
    opacity: 0;
    will-change: transform, opacity;
}

.flying-bat-reverse {
    animation-name: batFlyRight;
    left: auto;
    right: 0;
}

.bat-sprite {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(var(--scale));
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.75));
}

/* GIF olha para esquerda: espelha ao voar para direita */
.flying-bat:not(.flying-bat-reverse) .bat-img {
    transform: scaleX(-1) translateY(8px);
}

.flying-bat-reverse .bat-img {
    transform: translateY(8px);
}

.bat-img {
    width: 108px;
    height: auto;
    display: block;
    pointer-events: none;
    user-select: none;
    margin-bottom: -30px;
}

.bat-cargo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -8px;
    transform-origin: top center;
    animation: cargoSwing 2.4s ease-in-out infinite;
}

.cargo-rope {
    display: block;
    width: 2px;
    height: 20px;
    background: linear-gradient(180deg, #6d4c41 0%, #4e342e 55%, #3e2723 100%);
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.65);
    position: relative;
}

.cargo-rope::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    width: 6px;
    height: 4px;
    transform: translateX(-50%);
    background: #5d4037;
    border-radius: 2px;
}

.caixa-cube-img {
    width: 28px;
    height: auto;
    display: block;
    margin-top: 1px;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.55));
}

@keyframes batFlyLeft {
    0%   { transform: translateX(-12vw) translateY(0); opacity: 0; }
    3%   { opacity: 1; }
    25%  { transform: translateX(25vw) translateY(calc(var(--sway) * -1)); }
    50%  { transform: translateX(52vw) translateY(var(--sway)); }
    75%  { transform: translateX(78vw) translateY(calc(var(--sway) * -0.5)); }
    97%  { opacity: 1; }
    100% { transform: translateX(112vw) translateY(0); opacity: 0; }
}

@keyframes batFlyRight {
    0%   { transform: translateX(12vw) translateY(0); opacity: 0; }
    3%   { opacity: 1; }
    25%  { transform: translateX(-25vw) translateY(var(--sway)); }
    50%  { transform: translateX(-52vw) translateY(calc(var(--sway) * -1)); }
    75%  { transform: translateX(-78vw) translateY(calc(var(--sway) * 0.5)); }
    97%  { opacity: 1; }
    100% { transform: translateX(-112vw) translateY(0); opacity: 0; }
}

@keyframes cargoSwing {
    0%, 100% { transform: rotate(-7deg); }
    50%      { transform: rotate(7deg); }
}

/* ===== LAYOUT ===== */
.bg-matrix { position: relative; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    border-bottom: 1px solid var(--roo-border);
    background: rgba(8, 6, 10, 0.55);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0.12em;
    background: linear-gradient(90deg, #fff 0%, var(--roo-gold) 45%, var(--roo-red) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-transform: uppercase;
    filter: drop-shadow(0 0 12px rgba(255, 23, 68, 0.25));
}

.topbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 8, 12, 0.55);
    backdrop-filter: blur(12px);
}

.user-profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--roo-red) 0%, var(--roo-fire) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 23, 68, 0.3);
}

.user-profile-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.user-profile-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--roo-text);
}

.user-profile-license {
    font-size: 11px;
    color: var(--roo-text-dim);
}

.user-profile-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: 4px;
}

.page-center {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 68px);
    padding: 28px 20px;
    position: relative;
    z-index: 10;
}

.page-content {
    position: relative;
    z-index: 10;
    padding: 24px 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== GLASS CARDS ===== */
.glass-card {
    background: var(--roo-surface);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 20px;
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 23, 68, 0.06) inset,
        0 0 40px rgba(255, 23, 68, 0.04);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.glass-card:hover {
    border-color: rgba(255, 23, 68, 0.18);
}

.card {
    width: 100%;
    max-width: 440px;
    padding: 36px 32px;
}

.card-wide {
    max-width: 1140px;
    width: 100%;
    padding: 28px;
    margin: 0 auto;
}

h2 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 14px;
    color: var(--roo-text-dim);
    margin-bottom: 28px;
    line-height: 1.5;
}

.form-group { margin-bottom: 20px; text-align: left; }

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--roo-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

input, select {
    width: 100%;
    padding: 13px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.35);
    color: var(--roo-text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus, select:focus {
    border-color: rgba(255, 23, 68, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 23, 68, 0.12);
    background: rgba(0, 0, 0, 0.5);
}

input::placeholder { color: #5c6578; }

.btn {
    border: none;
    padding: 13px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--roo-red) 0%, var(--roo-red-dark) 100%);
    color: #fff;
    width: 100%;
    box-shadow: 0 8px 24px rgba(255, 23, 68, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(255, 23, 68, 0.45);
    filter: brightness(1.05);
}

.btn-primary:disabled {
    background: #3a3a45;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: var(--roo-text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 14px;
    font-size: 12px;
}

.btn-ghost:hover {
    color: var(--roo-text);
    border-color: rgba(255, 23, 68, 0.35);
    background: rgba(255, 23, 68, 0.08);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    width: 100%;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-success:hover { filter: brightness(1.06); }

.btn-danger {
    background: rgba(255, 23, 68, 0.12);
    color: #ff8a80;
    border: 1px solid rgba(255, 23, 68, 0.3);
    padding: 6px 10px;
    font-size: 11px;
}

.btn-danger:hover {
    background: rgba(255, 23, 68, 0.22);
    border-color: rgba(255, 23, 68, 0.5);
}

.btn-small { padding: 6px 10px; font-size: 11px; }

.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 36px 24px;
    text-align: center;
    background: rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: all 0.25s ease;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: rgba(255, 23, 68, 0.5);
    background: rgba(255, 23, 68, 0.06);
    box-shadow: 0 0 30px rgba(255, 23, 68, 0.08);
}

.drop-zone input[type="file"] { display: none; }

.file-info-badge {
    display: none;
    margin-top: 14px;
    background: rgba(255, 23, 68, 0.12);
    color: #ffcdd2;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 12px;
    word-break: break-all;
    border: 1px solid rgba(255, 23, 68, 0.2);
}

.progress-box { display: none; margin-top: 24px; }

.progress-status {
    font-size: 13px;
    color: var(--roo-gold);
    margin-bottom: 10px;
    font-weight: 500;
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 179, 71, 0.3);
}

.progress-bar-bg {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--roo-red-dark), var(--roo-red), var(--roo-fire));
    border-radius: 999px;
    transition: width 0.4s ease;
    box-shadow: 0 0 12px rgba(255, 23, 68, 0.5);
}

.report-box {
    display: none;
    margin-top: 24px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 20px;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.status-badge {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-badge.failed {
    background: rgba(255, 23, 68, 0.15);
    color: #ff8a80;
    border: 1px solid rgba(255, 23, 68, 0.35);
}

.error-box {
    display: none;
    margin-top: 20px;
    background: rgba(80, 10, 10, 0.5);
    border: 1px solid rgba(255, 23, 68, 0.3);
    color: #fca5a5;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 13px;
    backdrop-filter: blur(8px);
}

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 18px;
    backdrop-filter: blur(8px);
}

.alert-error {
    background: rgba(80, 10, 10, 0.55);
    border: 1px solid rgba(255, 23, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(6, 60, 45, 0.5);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}

.admin-section h3 {
    font-size: 17px;
    margin-bottom: 16px;
    color: #ffcdd2;
    font-weight: 600;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

th {
    color: var(--roo-text-dim);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(0, 0, 0, 0.2);
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: rgba(255, 23, 68, 0.04);
}

td code {
    font-family: ui-monospace, monospace;
    font-size: 10px;
    color: #ff8a80;
    word-break: break-all;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 420px;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
    width: 100%;
    max-width: 420px;
    padding: 28px;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h3 {
    margin-bottom: 18px;
    font-size: 18px;
}

.hidden { display: none !important; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.admin-header .subtitle { margin-bottom: 0; }

.quota-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    color: #ffb4b4;
    background: rgba(196, 30, 30, 0.18);
    border: 1px solid rgba(255, 23, 68, 0.35);
}

@media (max-width: 640px) {
    .topbar { padding: 12px 16px; }
    .user-profile-name { font-size: 12px; }
    .user-profile-license { font-size: 10px; }
    .card { padding: 28px 22px; }
    .actions-cell { min-width: 200px; }
    .bat-img { width: 82px; margin-bottom: -22px; }
    .flying-bat:not(.flying-bat-reverse) .bat-img { transform: scaleX(-1) translateY(6px); }
    .flying-bat-reverse .bat-img { transform: translateY(6px); }
    .bat-cargo { margin-top: -6px; }
    .caixa-cube-img { width: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .ambient-glow {
        animation: none !important;
    }

    .flying-bat {
        animation-duration: 22s !important;
    }

}
