:root {
    --bg-1: #0f172a;
    --bg-2: #1e293b;
    --accent: #7dd3fc;
    --accent-strong: #38bdf8;
    --glass: rgba(255, 255, 255, 0.12);
    --glass-strong: rgba(255, 255, 255, 0.22);
    --text: #f8fafc;
    --muted: rgba(248, 250, 252, 0.72);
    --danger: #f87171;
    --success: #34d399;
    --shadow: 0 30px 60px rgba(15, 23, 42, 0.35);
    --card-bg: rgba(15, 23, 42, 0.3);
    --outline: rgba(255, 255, 255, 0.2);
    --outline-soft: rgba(255, 255, 255, 0.08);
}

body.light {
    --bg-1: #f8fafc;
    --bg-2: #e2e8f0;
    --accent: #0ea5e9;
    --accent-strong: #2563eb;
    --glass: rgba(255, 255, 255, 0.72);
    --glass-strong: rgba(255, 255, 255, 0.9);
    --text: #0f172a;
    --muted: rgba(15, 23, 42, 0.6);
    --danger: #ef4444;
    --success: #10b981;
    --shadow: 0 30px 60px rgba(15, 23, 42, 0.18);
    --card-bg: rgba(255, 255, 255, 0.6);
    --outline: rgba(15, 23, 42, 0.12);
    --outline-soft: rgba(15, 23, 42, 0.08);
}

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

body {
    font-family: "Poppins", sans-serif;
    min-height: 100vh;
    color: var(--text);
    background: radial-gradient(circle at top, #1e3a8a, #0f172a 60%);
    overflow-x: hidden;
}

body.light {
    background: radial-gradient(circle at top, #e0f2fe, #f8fafc 60%);
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 20px 72px;
    position: relative;
    z-index: 2;
    animation: fadeIn 0.9s ease-out;
}

.bg-layer {
    position: fixed;
    inset: -20%;
    z-index: 0;
    filter: blur(60px);
    opacity: 0.7;
    animation: drift 24s ease-in-out infinite alternate;
    transform: translate3d(0, 0, 0);
}

.bg-1 {
    background: radial-gradient(circle at 20% 20%, #60a5fa, transparent 55%),
        radial-gradient(circle at 80% 40%, #f472b6, transparent 50%),
        radial-gradient(circle at 60% 70%, #22d3ee, transparent 60%);
}

.bg-2 {
    background: radial-gradient(circle at 30% 70%, #a78bfa, transparent 45%),
        radial-gradient(circle at 70% 30%, #38bdf8, transparent 55%);
    animation-duration: 32s;
    opacity: 0.55;
}

body.light .bg-1 {
    background: radial-gradient(circle at 20% 20%, #bae6fd, transparent 55%),
        radial-gradient(circle at 80% 40%, #fbcfe8, transparent 50%),
        radial-gradient(circle at 60% 70%, #99f6e4, transparent 60%);
    opacity: 0.8;
}

body.light .bg-2 {
    background: radial-gradient(circle at 30% 70%, #c7d2fe, transparent 45%),
        radial-gradient(circle at 70% 30%, #93c5fd, transparent 55%);
    opacity: 0.6;
}

body.light .drop-zone {
    border-color: rgba(15, 23, 42, 0.2);
}

body.light .drop-zone.dragover {
    background: rgba(14, 165, 233, 0.12);
    box-shadow: 0 0 25px rgba(14, 165, 233, 0.25);
}

body.light .btn.primary {
    color: #f8fafc;
}

.bg-noise {
    position: fixed;
    inset: 0;
    z-index: 1;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='0.12'/></svg>");
    opacity: 0.2;
    pointer-events: none;
}

.upload-card {
    width: min(900px, 96vw);
    background: var(--glass);
    border: 1px solid var(--outline);
    border-radius: 28px;
    padding: 32px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    position: relative;
    animation: floatCard 6s ease-in-out infinite;
}

.card-header {
    text-align: center;
    margin-bottom: 24px;
}

.header-actions {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
}

.theme-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent);
}

.alert {
    padding: 12px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    background: rgba(248, 113, 113, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fee2e2;
    font-size: 13px;
}

.auth {
    background: var(--card-bg);
    border: 1px solid var(--outline-soft);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 20px;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.auth-tab.active {
    background: rgba(56, 189, 248, 0.2);
    box-shadow: 0 10px 20px rgba(56, 189, 248, 0.25);
}

.auth-panel {
    display: none;
    gap: 12px;
    flex-direction: column;
}

.auth-panel.active {
    display: flex;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.input-group input,
.input-group select {
    background: var(--card-bg);
    border: 1px solid var(--outline-soft);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 12px;
    outline: none;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:focus,
.input-group select:focus {
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.input-group small {
    color: var(--muted);
}

.user-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    border: 1px solid var(--outline-soft);
    border-radius: 18px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-role {
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.3px;
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

.subtitle {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
}

.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 22px;
    padding: 24px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
    background: var(--card-bg);
    cursor: pointer;
}

.drop-zone.disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--muted);
    pointer-events: none;
}

.drop-zone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-zone.dragover {
    border-color: var(--accent);
    box-shadow: 0 0 25px rgba(125, 211, 252, 0.45);
    background: rgba(56, 189, 248, 0.12);
    transform: scale(1.01);
}

.drop-content h3 {
    font-size: 18px;
    margin-top: 8px;
}

.drop-content p {
    font-size: 13px;
    color: var(--muted);
    margin-top: 6px;
}

.drop-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    margin: 0 auto 8px;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 24px;
    color: var(--accent);
    background: rgba(125, 211, 252, 0.12);
    box-shadow: 0 0 20px rgba(125, 211, 252, 0.25);
}

.preview {
    margin-top: 20px;
    padding: 16px;
    border-radius: 18px;
    background: var(--card-bg);
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: transform 0.2s ease;
}

.preview-empty {
    font-size: 14px;
}

.preview.has-file {
    justify-content: flex-start;
    gap: 16px;
    color: var(--text);
}

.preview img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.4);
}

.preview .file-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preview .file-meta span {
    font-size: 14px;
    color: var(--muted);
}

.preview .file-type {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
    width: fit-content;
}

.progress-wrap {
    position: relative;
    height: 12px;
    background: var(--card-bg);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 18px;
    display: none;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    right: 10px;
    top: -26px;
    font-size: 12px;
    color: var(--muted);
}

.actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.btn {
    border: none;
    padding: 12px 20px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    cursor: not-allowed;
    transform: none;
}

.btn.primary {
    background: linear-gradient(120deg, #38bdf8, #6366f1);
    color: #0f172a;
    box-shadow: 0 10px 25px rgba(56, 189, 248, 0.35);
}

.btn.primary:hover {
    transform: scale(1.03);
    box-shadow: 0 14px 30px rgba(56, 189, 248, 0.45);
}

.btn.ghost {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.btn.ghost:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
}

.btn.danger {
    background: rgba(248, 113, 113, 0.2);
    color: #fee2e2;
}

.btn.danger:hover {
    transform: scale(1.04);
    background: rgba(248, 113, 113, 0.35);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.success-check {
    width: 40px;
    height: 40px;
    display: none;
}

.success-check svg {
    width: 100%;
    height: 100%;
    stroke: var(--success);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.success-check.show svg circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: circle 0.6s ease forwards;
}

.success-check.show svg path {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: check 0.4s ease 0.6s forwards;
}

.uploaded {
    margin-top: 26px;
}

.uploaded-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.uploaded-header h4 {
    font-size: 16px;
}

.badge {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--outline-soft);
    animation: listIn 0.4s ease;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(15, 23, 42, 0.4);
}

.file-item.empty {
    justify-content: center;
    color: var(--muted);
    font-size: 14px;
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
}

.file-size {
    font-size: 12px;
    color: var(--muted);
}

.file-uploader {
    font-size: 12px;
    color: rgba(125, 211, 252, 0.8);
}

.file-actions {
    display: flex;
    gap: 10px;
}

.toast-container {
    position: fixed;
    top: 28px;
    right: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
}

.toast {
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.65);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35);
    animation: toastIn 0.4s ease;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.ripple-circle {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s linear;
    background: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.shake {
    animation: shake 0.4s ease;
}

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

@keyframes floatCard {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

@keyframes drift {
    0% { transform: translate3d(-2%, -2%, 0); }
    100% { transform: translate3d(2%, 2%, 0); }
}

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

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

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

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

@keyframes listOut {
    to { opacity: 0; transform: translateY(10px); }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

@media (max-width: 700px) {
    .upload-card {
        padding: 24px 20px;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .file-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
