/* ============================================================
   Purchase Requests – Modern UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

/* ---------- Tokens ---------- */
:root {
    --brand:         #4f6ef7;
    --brand-dark:    #3b55d4;
    --brand-light:   #eef1fe;
    --brand-mid:     #c7d0fc;
    --success:       #16a34a;
    --success-bg:    #dcfce7;
    --warning:       #b45309;
    --warning-bg:    #fef3c7;
    --danger:        #dc2626;
    --danger-bg:     #fee2e2;
    --text:          #111827;
    --text-muted:    #6b7280;
    --text-subtle:   #9ca3af;
    --border:        #e5e7eb;
    --border-focus:  #4f6ef7;
    --bg:            #f3f4f8;
    --surface:       #ffffff;
    --surface-2:     #f9fafb;
    --topbar-bg:     #1e2235;
    --radius-sm:     6px;
    --radius:        10px;
    --radius-lg:     14px;
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:        0 4px 16px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
    --shadow-lg:     0 10px 40px rgba(0,0,0,0.12);
    --transition:    0.15s ease;
}

/* ---------- Base ---------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.9375rem;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top Bar (header + nav combined) ---------- */
.topbar {
    background: var(--topbar-bg);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
    margin-right: 2rem;
    flex-shrink: 0;
}

.topbar-brand:hover { text-decoration: none; }

.brand-icon {
    width: 30px;
    height: 30px;
    background: var(--brand);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

.topbar-nav a {
    color: #9ca3af;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
    text-decoration: none;
}

.topbar-nav a:hover { color: #fff; background: rgba(255,255,255,0.07); }
.topbar-nav a.active { color: #fff; background: rgba(255,255,255,0.1); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.topbar-username {
    color: #9ca3af;
    font-size: 0.85rem;
    font-weight: 500;
}

.topbar-logout {
    color: #6b7280;
    font-size: 0.82rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid #374151;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    text-decoration: none;
}
.topbar-logout:hover {
    color: #e5e7eb;
    border-color: #6b7280;
    background: rgba(255,255,255,0.05);
    text-decoration: none;
}

/* ---------- Flash Messages ---------- */
.flash-messages {
    max-width: 1200px;
    margin: 1.25rem auto 0;
    padding: 0 1.75rem;
}

.alert {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert::before { font-size: 1rem; flex-shrink: 0; }
.alert-success { background: var(--success-bg); color: var(--success);  border-color: #86efac; }
.alert-success::before { content: '✓'; }
.alert-error   { background: var(--danger-bg);  color: var(--danger);   border-color: #fca5a5; }
.alert-error::before   { content: '✕'; }
.alert-warning { background: var(--warning-bg); color: var(--warning);  border-color: #fcd34d; }
.alert-warning::before { content: '!'; }

/* ---------- Main ---------- */
main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.75rem;
}


/* ---------- Page Header ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 1px 3px rgba(79,110,247,0.3);
}
.btn-primary:hover {
    background: var(--brand-dark);
    box-shadow: 0 4px 12px rgba(79,110,247,0.4);
    text-decoration: none;
    color: #fff;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
    border-color: #d1d5db;
}

.btn-approve {
    background: var(--success);
    color: #fff;
    box-shadow: 0 1px 3px rgba(22,163,74,0.3);
}
.btn-approve:hover {
    background: #15803d;
    text-decoration: none;
    color: #fff;
    transform: translateY(-1px);
}

.btn-edit {
    background: var(--brand-light);
    color: var(--brand);
    border: 1px solid var(--brand-mid);
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
}
.btn-edit:hover {
    background: #dce2fd;
    text-decoration: none;
    border-color: var(--brand);
}

.btn-microsoft {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    gap: 0.65rem;
    box-shadow: var(--shadow-sm);
    margin-top: 0.5rem;
    border-radius: var(--radius);
    font-weight: 500;
}
.btn-microsoft:hover {
    background: var(--surface-2);
    box-shadow: var(--shadow);
    text-decoration: none;
    transform: translateY(-1px);
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-approved {
    background: var(--success-bg);
    color: var(--success);
}
.badge-approved::before { content: '●'; font-size: 0.5rem; }

.badge-pending {
    background: var(--warning-bg);
    color: var(--warning);
}
.badge-pending::before { content: '●'; font-size: 0.5rem; }

.badge-billable {
    background: var(--brand-light);
    color: var(--brand-dark);
}

/* ---------- Table ---------- */
.table-wrapper {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow-x: auto;
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.data-table th {
    padding: 0.75rem 1.1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.data-table td {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
    transition: background var(--transition);
}
.data-table tbody tr:hover { background: #fafafa; }

.requester-name  { font-weight: 600; color: var(--text); }
.requester-email { font-size: 0.78rem; color: var(--text-muted); margin-top: 1px; }
.item-cell       { max-width: 280px; font-weight: 500; }
.date-cell       { white-space: nowrap; color: var(--text-subtle); font-size: 0.82rem; }
.muted           { color: var(--text-subtle); }

.category-tag {
    display: inline-block;
    padding: 0.18rem 0.6rem;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #4b5563;
    white-space: nowrap;
    border: 1px solid #e5e7eb;
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state p { margin-bottom: 1.25rem; font-size: 1rem; color: var(--text-muted); }

/* ---------- Form Card ---------- */
.form-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 2.25rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.form-section {
    border: none;
    padding: 0;
    margin-bottom: 2rem;
}

.form-section legend {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    padding-bottom: 0.5rem;
    margin-bottom: 1.1rem;
    width: 100%;
    display: block;
    border-bottom: 1px solid var(--border);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.form-group-checkbox { justify-content: flex-end; }

label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

.required { color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="number"],
input[type="url"],
select,
textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
    line-height: 1.5;
}

textarea { resize: vertical; min-height: 80px; }

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79,110,247,0.15);
}

input[disabled],
.input-readonly {
    background: var(--surface-2);
    color: var(--text-subtle);
    cursor: default;
    border-color: #f0f0f0;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
    padding: 0.55rem 0;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--brand);
    border-radius: 3px;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

/* ---------- Detail Page ---------- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1.25rem;
}

.detail-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.5rem;
}

.detail-card h3 {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 1.1rem;
}

.detail-card h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.6rem;
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.55rem 1.25rem;
    font-size: 0.875rem;
}

.detail-list dt {
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    font-size: 0.82rem;
}

.detail-list dd { word-break: break-word; color: var(--text); }

.approve-section {
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border);
}

.form-row-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.approve-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.approve-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79,110,247,0.15);
}

/* ---------- Login Page ---------- */
body.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e2235 0%, #2d3461 100%);
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.75rem 3rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-logo {
    width: 52px;
    height: 52px;
    background: var(--brand);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.4rem;
    box-shadow: 0 4px 16px rgba(79,110,247,0.35);
}

.login-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
    letter-spacing: -0.02em;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .topbar { padding: 0 1rem; }
    .topbar-brand { margin-right: 1rem; }
    main { padding: 0 1rem; margin-top: 1.25rem; }
    .flash-messages { padding: 0 1rem; }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .form-card { padding: 1.5rem; }
    .detail-grid { grid-template-columns: 1fr; }
    .data-table th, .data-table td { padding: 0.6rem 0.75rem; }
    .login-card { padding: 2rem 1.5rem; margin: 1rem; }
    .topbar-username { display: none; }
}
