/* =========================================
   style.css — Modern Design System
   vercel-mongo-crud / Fuel Manager
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---- CSS Variables ---- */
:root {
    /* Colors - Modern Palette */
    --color-bg: #0a0e27;
    --color-bg-secondary: #111832;
    --color-surface: #1a1f3a;
    --color-surface-hover: #232d52;
    --color-surface-2: #252d4a;
    --color-border: #353d5e;
    --color-border-light: #414959;
    --color-border-focus: #6366f1;

    --color-primary: #6366f1;
    --color-primary-hover: #4f46e5;
    --color-primary-light: #818cf8;
    --color-success: #10b981;
    --color-success-light: #34d399;
    --color-warning: #f59e0b;
    --color-warning-light: #fbbf24;
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-danger-light: #f87171;

    --color-text: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #94a3b8;
    --color-text-hint: #64748b;

    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-lg: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-secondary) 100%);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.1rem;
}

p {
    color: var(--color-text-secondary);
}

/* ---- Layout ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

@media (max-width: 768px) {
    .container {
        padding: 24px 16px 60px;
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}

.page-header h2 {
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header-actions {
        width: 100%;
    }
}

/* ---- Card ---- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    backdrop-filter: blur(10px);
}

.card:hover {
    border-color: var(--color-border-light);
    box-shadow: var(--shadow);
}

.card h3 {
    margin-bottom: 12px;
    font-size: 1.2rem;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card h4 {
    margin-bottom: 8px;
    color: var(--color-text);
    font-size: 1rem;
}

.hint {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hint::before {
    content: 'ℹ';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    font-size: 0.7rem;
    color: var(--color-primary);
}

@media (max-width: 768px) {
    .card {
        padding: 20px;
    }
}

/* ---- Inputs ---- */
.input {
    background: var(--color-surface-2);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    width: 100%;
    transition: all var(--transition);
    outline: none;
}

.input::placeholder {
    color: var(--color-text-hint);
}

.input:hover {
    border-color: var(--color-border-light);
    background: var(--color-surface-2);
}

.input:focus {
    border-color: var(--color-primary);
    background: var(--color-surface-2);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.input:disabled {
    background: var(--color-surface);
    color: var(--color-text-hint);
    cursor: not-allowed;
}

.input-number {
    width: 120px;
    flex-shrink: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: capitalize;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--color-surface-2);
    color: var(--color-text-secondary);
    border: 1.5px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-surface-hover);
    border-color: var(--color-primary);
    color: var(--color-text);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger) 0%, var(--color-danger-hover) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-light) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

/* ---- Fuel List ---- */
.fuel-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .fuel-list {
        grid-template-columns: 1fr;
    }
}

.fuel-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--color-surface-2);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    transition: all var(--transition);
}

.fuel-item:hover {
    border-color: var(--color-primary);
    background: var(--color-surface-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.fuel-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fuel-item .serial {
    font-size: 0.8rem;
    color: var(--color-primary);
    font-weight: 700;
    background: rgba(99, 102, 241, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    min-width: 40px;
    text-align: center;
}

.fuel-name {
    flex: 1;
    font-weight: 600;
    color: var(--color-text);
    font-size: 1.1rem;
}

.fuel-item-body {
    display: flex;
    gap: 12px;
    align-items: center;
}

.fuel-item-body .input {
    flex: 1;
    min-width: 0;
}

.fuel-item-actions {
    display: flex;
    gap: 8px;
}

/* ---- Form row ---- */
.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row .input {
        width: 100%;
    }
}

/* ---- Loading skeleton ---- */
.skeleton {
    background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-border) 50%, var(--color-surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
    height: 80px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ---- Toast ---- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

@media (max-width: 640px) {
    #toast-container {
        left: 16px;
        right: 16px;
        bottom: 20px;
    }
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 380px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    list-style: none;
}

.toast::before {
    content: none;
}

.toast-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--color-success);
    color: var(--color-success-light);
}

.toast-success::before {
    background: var(--color-success);
}

.toast-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--color-danger);
    color: var(--color-danger-light);
}

.toast-error::before {
    background: var(--color-danger);
}

.toast-info {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--color-primary);
    color: var(--color-primary-light);
}

.toast-info::before {
    background: var(--color-primary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ---- Login form ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-secondary) 50%, var(--color-surface) 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    top: -100px;
    right: -100px;
    z-index: 0;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    bottom: -100px;
    left: -100px;
    z-index: 0;
}

.login-card {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.login-card h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-card .subtitle {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 32px;
    font-weight: 400;
}

.error-msg {
    color: var(--color-danger-light);
    font-size: 0.85rem;
    margin-top: 6px;
    display: none;
    font-weight: 500;
}

@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
    }

    .login-card h1 {
        font-size: 1.5rem;
    }
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 40px;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

.modal-content h2 {
    margin-bottom: 12px;
    font-size: 1.4rem;
}

.modal-content .hint {
    margin-bottom: 28px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 28px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 28px 24px;
        max-width: none;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

/* ---- Tab Navigation ---- */
.tab-navigation {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    border-bottom: 1.5px solid var(--color-border);
    overflow-x: auto;
}

.tab-btn {
    padding: 14px 20px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
    text-transform: capitalize;
}

.tab-btn:hover {
    color: var(--color-text-secondary);
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

@media (max-width: 640px) {
    .tab-navigation {
        gap: 4px;
    }

    .tab-btn {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
}

/* ---- User/Item List ---- */
.user-list,
.item-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.user-item,
.item-entry {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--color-surface-2);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    transition: all var(--transition);
}

.user-item:hover,
.item-entry:hover {
    border-color: var(--color-primary);
    background: var(--color-surface-hover);
    box-shadow: var(--shadow-sm);
}

.user-item .user-name,
.item-entry .item-name {
    flex: 1;
    font-weight: 600;
    color: var(--color-text);
    font-size: 1rem;
}

.user-item .user-role {
    font-size: 0.75rem;
    color: var(--color-primary);
    padding: 6px 12px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Add Form ---- */
.add-form {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(99, 102, 241, 0.02) 100%);
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all var(--transition);
}

.add-form:hover {
    border-color: var(--color-primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0.03) 100%);
}

.add-form h4 {
    margin: 0;
    color: var(--color-text);
    font-size: 0.95rem;
}

.add-form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .add-form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .add-form-row .input {
        width: 100%;
    }
}

.add-form-row .input {
    flex: 1;
    min-width: 150px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    .page-header {
        margin-bottom: 28px;
    }

    .form-row {
        gap: 10px;
    }

    .fuel-list {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: 20px 12px 50px;
    }

    .card {
        padding: 16px;
        margin-bottom: 16px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .input-number {
        width: 100%;
    }
}