/*
 * Billing theme — layered on top of the compiled Bootstrap 4 bundle (css/app.css).
 */

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --border: #e5e8f0;
    --text: #1d2433;
    --muted: #6b7489;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef0ff;
    --success: #12a150;
    --success-soft: #e6f6ed;
    --danger: #dc3545;
    --danger-soft: #fdecee;
    --warning: #b7791f;
    --warning-soft: #fdf5e6;
    --info: #0b7ea8;
    --info-soft: #e5f4fa;
    --sidebar: #141a2b;
    --sidebar-text: #a7b0c6;
    --sidebar-width: 248px;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: .9rem;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4, h5 { font-weight: 600; color: var(--text); }

/* ---------- App shell ---------- */

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .2s ease;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.25rem 1.25rem 1.5rem;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

.app-brand:hover { color: #fff; text-decoration: none; }

.app-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    display: grid;
    place-items: center;
    font-size: 1.05rem;
}

.app-nav { list-style: none; padding: 0 .75rem; margin: 0; flex: 1; }

.app-nav-label {
    color: #5d6782;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .75rem .75rem .4rem;
}

.app-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    margin-bottom: 2px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-weight: 500;
}

.app-nav a i { font-size: 1.05rem; }

.app-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }

.app-nav a.active { background: var(--primary); color: #fff; }

.app-sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
    display: flex;
    align-items: center;
    gap: .65rem;
}

.app-sidebar-footer .user-name { color: #fff; font-weight: 500; line-height: 1.2; }
.app-sidebar-footer .user-email { color: var(--sidebar-text); font-size: .75rem; }

.app-sidebar-footer .btn-logout {
    margin-left: auto;
    background: none;
    border: 0;
    color: var(--sidebar-text);
    font-size: 1.1rem;
    padding: .25rem;
}

.app-sidebar-footer .btn-logout:hover { color: #fff; }

.app-main { margin-left: var(--sidebar-width); min-height: 100vh; }

.app-topbar {
    display: none;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.app-topbar .btn-menu { background: none; border: 0; font-size: 1.4rem; padding: 0; color: var(--text); }

.app-content { padding: 2rem 2.25rem 3rem; max-width: 1400px; }

.app-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 35, .45);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-main { margin-left: 0; }
    .app-topbar { display: flex; }
    .app-content { padding: 1.25rem 1rem 2rem; }
    body.sidebar-open .app-sidebar { transform: none; }
    body.sidebar-open .app-backdrop { display: block; }
}

/* ---------- Page header ---------- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 { font-size: 1.5rem; margin: 0; }
.page-header .subtitle { color: var(--muted); margin: .25rem 0 0; }

.breadcrumb-lite { font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.breadcrumb-lite a { color: var(--muted); }

/* ---------- Cards ---------- */

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-header h2, .card-header h3 { font-size: 1rem; margin: 0; }
.card-body { padding: 1.25rem; }

.card.stat-card { flex-direction: row; align-items: center; gap: 1rem; padding: 1.25rem; }

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat-value { font-size: 1.5rem; font-weight: 600; line-height: 1.2; }

.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-info { background: var(--info-soft); color: var(--info); }

/* ---------- Buttons & forms ---------- */

.btn { border-radius: 8px; font-weight: 500; font-size: .875rem; padding: .5rem 1rem; }
.btn i { margin-right: .35rem; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-light { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-light:hover { background: #f1f3f8; border-color: var(--border); }
.btn-soft-danger { background: var(--danger-soft); color: var(--danger); border: 0; }
.btn-soft-danger:hover { background: var(--danger); color: #fff; }

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-grid;
    place-items: center;
}

.btn-icon i { margin: 0; }

label { font-weight: 500; font-size: .825rem; margin-bottom: .35rem; }

.form-control, .custom-select {
    border-radius: 8px;
    border-color: #d7dbe6;
    font-size: .875rem;
    height: calc(1.5em + 1rem + 2px);
    padding: .5rem .75rem;
}

textarea.form-control { height: auto; }

.form-control:focus, .custom-select:focus {
    border-color: #a5a1f5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}

.form-text { color: var(--muted); }

.input-group-text { border-radius: 8px; border-color: #d7dbe6; background: #f6f7fb; font-size: .85rem; }

/* ---------- Tables ---------- */

.table { margin-bottom: 0; color: var(--text); }

.table thead th {
    border-top: 0;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: .75rem 1rem;
    background: #fafbfd;
}

.table td { border-top: 1px solid var(--border); padding: .85rem 1rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8f9fd; }

.cell-title { font-weight: 500; color: var(--text); }
.cell-sub { color: var(--muted); font-size: .8rem; }

.table-details td:first-child { color: var(--muted); width: 220px; }
.table-details td { border-top: 1px solid var(--border); }
.table-details tr:first-child td { border-top: 0; }

/* DataTables */
.dataTables_wrapper { padding: 1rem 0 0; }
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter { padding: 0 1rem .75rem; color: var(--muted); font-size: .825rem; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #d7dbe6;
    border-radius: 8px;
    padding: .35rem .6rem;
    margin-left: .4rem;
}
.dataTables_wrapper .dataTables_info { padding: 1rem; color: var(--muted); font-size: .8rem; }
.dataTables_wrapper .dataTables_paginate { padding: .75rem 1rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    border: 1px solid transparent !important;
    font-size: .8rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-soft) !important;
    color: var(--primary) !important;
}
table.dataTable.no-footer { border-bottom: 0; }
table.dataTable thead th { border-bottom: 1px solid var(--border) !important; }

/* ---------- Badges, alerts, misc ---------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
    white-space: nowrap;
}

.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.status-success { background: var(--success-soft); color: var(--success); }
.status-danger { background: var(--danger-soft); color: var(--danger); }
.status-warning { background: var(--warning-soft); color: var(--warning); }
.status-muted { background: #eef0f5; color: var(--muted); }
.status-info { background: var(--info-soft); color: var(--info); }

.tag {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 6px;
    background: #eef0f5;
    color: #4a5368;
    font-size: .75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.alert { border: 0; border-radius: 10px; display: flex; gap: .65rem; align-items: flex-start; }
.alert i { font-size: 1.05rem; line-height: 1.3; }
.alert-success { background: var(--success-soft); color: #0b6b36; }
.alert-danger { background: var(--danger-soft); color: #a3202d; }
.alert ul { margin: .25rem 0 0; padding-left: 1.1rem; }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-grid;
    place-items: center;
    font-weight: 600;
    font-size: .8rem;
    flex-shrink: 0;
    text-transform: uppercase;
}

.licence-key {
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .85rem;
    background: #f6f7fb;
    border: 1px dashed #c9cede;
    border-radius: 8px;
    padding: .55rem .75rem;
    text-transform: uppercase;
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.licence-key .btn-copy { background: none; border: 0; color: var(--primary); padding: 0; font-size: 1rem; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #b5bccd; }

/* ---------- Modals ---------- */

.modal-content { border: 0; border-radius: 14px; box-shadow: 0 20px 50px rgba(15, 20, 35, .2); }
.modal-header { border-bottom: 1px solid var(--border); padding: 1.1rem 1.5rem; }
.modal-title { font-size: 1.05rem; font-weight: 600; }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.5rem; }

/* ---------- Guest / public pages ---------- */

.guest-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 500px at 10% -10%, #e6e8ff 0%, transparent 60%),
        radial-gradient(900px 400px at 110% 10%, #e3f3fb 0%, transparent 60%),
        var(--bg);
}

.guest-header { padding: 1.25rem 1.5rem; }
.guest-header .app-brand { color: var(--text); padding: 0; }
.guest-header .app-brand-mark { color: #fff; }

.guest-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem 3rem; }

.guest-card { width: 100%; max-width: 420px; }
.guest-card.wide { max-width: 640px; }
.guest-card .card-body { padding: 2rem; }
.guest-card h1 { font-size: 1.35rem; margin-bottom: .35rem; }
.guest-card .lead-muted { color: var(--muted); margin-bottom: 1.5rem; }

.guest-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }

.summary-list { list-style: none; padding: 0; margin: 0; }
.summary-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.summary-list li:last-child { border-bottom: 0; }
.summary-list .k { color: var(--muted); }
.summary-list .v { font-weight: 500; text-align: right; }

.total-box {
    background: var(--primary-soft);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-box .amount { font-size: 1.35rem; font-weight: 600; color: var(--primary); }

.success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    display: grid;
    place-items: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
}
