/* ===== RESET & VARIABLES ===== */
:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface-hover: #1a1a26;
    --border: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(255, 85, 0, 0.5);
    --text: #f0f0f5;
    --text-dim: #6b6b80;
    --accent: #ff5500;
    --accent-light: #ff7733;
    --accent-glow: rgba(255, 85, 0, 0.15);
    --radius: 14px;
    --radius-lg: 24px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* ===== ANIMATED BACKGROUND BLOBS ===== */
.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 85, 0, 0.25), transparent 70%);
    top: -15%;
    left: -10%;
    animation: float1 20s ease-in-out infinite alternate;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(138, 43, 226, 0.15), transparent 70%);
    bottom: -10%;
    right: -5%;
    animation: float2 18s ease-in-out infinite alternate;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 120, 0, 0.12), transparent 70%);
    top: 50%;
    left: 60%;
    animation: float3 22s ease-in-out infinite alternate;
}

@keyframes float1 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(80px, 60px) scale(1.2);
    }
}

@keyframes float2 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(-60px, -80px) scale(1.15);
    }
}

@keyframes float3 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(-40px, 40px) scale(1.1);
    }
}

/* ===== APP CONTAINER ===== */
.app {
    width: 100%;
    max-width: 480px;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
}

/* ===== HERO SECTION ===== */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: cover;
    margin-bottom: 1rem;
    box-shadow:
        0 0 0 1px rgba(255, 85, 0, 0.1),
        0 8px 32px rgba(255, 85, 0, 0.15);
    animation: logoGlow 4s ease-in-out infinite alternate;
}

@keyframes logoGlow {
    0% {
        box-shadow: 0 0 0 1px rgba(255, 85, 0, 0.1), 0 8px 32px rgba(255, 85, 0, 0.15);
    }

    100% {
        box-shadow: 0 0 0 1px rgba(255, 85, 0, 0.2), 0 12px 48px rgba(255, 85, 0, 0.25);
    }
}

.hero-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.hero-title span {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.4;
}

/* ===== CARD ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 1px 0 0 rgba(255, 255, 255, 0.03) inset,
        0 24px 64px rgba(0, 0, 0, 0.4);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 1px 0 0 rgba(255, 255, 255, 0.05) inset,
        0 32px 80px rgba(0, 0, 0, 0.5);
}

/* ===== FORM FIELDS ===== */
.field {
    margin-bottom: 1.25rem;
}

.field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.field label svg {
    opacity: 0.5;
}

.label-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.5;
    margin-left: auto;
    font-size: 0.72rem;
}

.field input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: all 0.25s ease;
    outline: none;
}

.field input::placeholder {
    color: rgba(255, 255, 255, 0.15);
}

.field input:focus {
    border-color: var(--border-focus);
    background: rgba(255, 85, 0, 0.04);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Select / Dropdown */
.field select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: all 0.25s ease;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b80' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.field select:focus {
    border-color: var(--border-focus);
    background-color: rgba(255, 85, 0, 0.04);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.field select option {
    background: var(--surface);
    color: var(--text);
    padding: 10px;
}

/* ===== BUTTON ===== */
button[type="submit"] {
    width: 100%;
    padding: 15px 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 0.5rem;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 8px 24px rgba(255, 85, 0, 0.25);
    position: relative;
    overflow: hidden;
}

button[type="submit"]::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(255, 85, 0, 0.35);
}

button[type="submit"]:hover::before {
    opacity: 1;
}

button[type="submit"]:active {
    transform: translateY(1px);
    box-shadow: 0 4px 12px rgba(255, 85, 0, 0.2);
}

button[type="submit"]:disabled {
    background: #333;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.btn-icon {
    flex-shrink: 0;
}

/* ===== SPINNER ===== */
.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* ===== STATUS MESSAGE ===== */
.status-msg {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 20px;
    line-height: 1.4;
}

.status-success {
    color: #34d399;
}

.status-error {
    color: #f87171;
}

.status-loading {
    color: var(--text-dim);
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--text-dim);
    opacity: 0.6;
}

footer a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 540px) {
    .app {
        padding: 1.5rem 1rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-logo {
        width: 64px;
        height: 64px;
        border-radius: 16px;
    }

    .card {
        padding: 1.5rem;
        border-radius: 20px;
    }
}

/* ===== USER CHIP (floating pill) ===== */
.user-chip {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 50px;
    transition: all 0.25s ease;
}

.user-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.12);
}

.user-chip-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.2px;
}

.user-chip-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
    text-decoration: none;
    transition: all 0.2s ease;
}

.user-chip-logout:hover {
    background: rgba(248, 113, 113, 0.25);
    transform: scale(1.1);
}

/* ===== TOPBAR ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}

.topbar-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.topbar-user {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 500;
}

.topbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.topbar-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.topbar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.topbar-link-danger {
    border-color: rgba(248, 113, 113, 0.3);
    color: #f87171;
}

.topbar-link-danger:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    text-align: center;
}

.alert-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: #f87171;
}

.alert-success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.25);
    color: #34d399;
}

/* ===== ADMIN PANEL ===== */
.app-wide {
    max-width: 780px;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 100px;
    gap: 12px;
    margin-bottom: 0.75rem;
}

.btn-add {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(255, 85, 0, 0.2);
}

.btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(255, 85, 0, 0.3);
}

/* Table */
.table-wrap {
    overflow-x: auto;
    margin: 0 -0.5rem;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.user-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.7rem;
    border-bottom: 1px solid var(--border);
}

.user-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.user-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.td-user {
    font-weight: 600;
}

.td-date {
    color: var(--text-dim);
    font-size: 0.78rem;
}

.td-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.td-actions form {
    margin: 0;
    padding: 0;
    display: flex;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-active {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.badge-expired {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

/* Small action buttons */
.btn-sm {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    white-space: nowrap;
    transition: all 0.2s;
    background: linear-gradient(135deg, #ff5500, #ff8800);
    color: white;
    box-shadow: 0 4px 16px rgba(255, 85, 0, 0.2);
}

.btn-sm:hover {
    box-shadow: 0 6px 24px rgba(255, 85, 0, 0.35);
    transform: translateY(-1px);
}

.empty-state {
    text-align: center;
    color: var(--text-dim);
    padding: 2rem 0;
    font-size: 0.9rem;
}

/* Responsive admin */
@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .app-wide {
        max-width: 100%;
    }

    .td-actions {
        flex-direction: column;
    }
}