/* ==========================================================
   Ropay merchant portal styles
   Colours come from the Ropay logo:
   teal (notes), green (notes), gold (coin), dark olive (word "ROPAY")
   ========================================================== */

:root {
    --ropay-teal: #0b6477;
    --ropay-teal-dark: #084c5b;
    --ropay-green: #1f8a3b;
    --ropay-gold: #d4ac0d;
    --ropay-gold-light: #fbf3d0;
    --ropay-olive: #3a3a0c;
    --page-bg: #f4f6f5;
    --card-border: #e3e7e5;
    --text-muted: #6b7470;
    --sidebar-width: 240px;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #23281f;
}

/* ---------- Brand button ---------- */
.btn-brand {
    background: var(--ropay-teal);
    border-color: var(--ropay-teal);
    color: #fff;
}
.btn-brand:hover,
.btn-brand:focus {
    background: var(--ropay-teal-dark);
    border-color: var(--ropay-teal-dark);
    color: #fff;
}

a { color: var(--ropay-teal); }

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--ropay-teal);
    box-shadow: 0 0 0 .2rem rgba(11, 100, 119, .15);
}
.form-check-input:checked {
    background-color: var(--ropay-teal);
    border-color: var(--ropay-teal);
}

/* ---------- App layout (sidebar + page) ---------- */
.app-body { background: var(--page-bg); }

.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--ropay-olive);
    color: #e9e9d8;
    display: flex;
    flex-direction: column;
    padding: 1rem .75rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
    padding: .25rem .5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    margin-bottom: 1rem;
}
.app-brand img { border-radius: 10px; background: #dcdcdc; }
.app-brand small { display: block; font-weight: 400; font-size: .75rem; color: var(--ropay-gold); letter-spacing: .05em; text-transform: uppercase; }

.app-nav { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; }

.app-nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .75rem;
    border-radius: 8px;
    color: #d8d8c4;
    text-decoration: none;
    font-size: .93rem;
}
.app-nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.app-nav-link.active { background: var(--ropay-gold); color: var(--ropay-olive); font-weight: 600; }

.app-signout { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: .75rem; }

.app-main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid var(--card-border);
    /* Thin bar of the logo colours along the top */
    border-top: 4px solid transparent;
    border-image: linear-gradient(90deg, var(--ropay-gold), var(--ropay-green), var(--ropay-teal)) 1;
}
.app-page-title { font-size: 1.2rem; margin: 0; flex-grow: 1; font-weight: 600; }

.app-company { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--text-muted); }
.app-company img { border-radius: 50%; object-fit: cover; }
.app-company-initial {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--ropay-teal); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600;
}

.app-content { padding: 1.5rem; flex-grow: 1; }

.app-footer { padding: 1rem 1.5rem; font-size: .8rem; color: var(--text-muted); }

/* Small screens: sidebar slides in from the left */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        z-index: 1040;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .app-sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
    .app-content { padding: 1rem; }
    .app-topbar { padding: .75rem 1rem; }
}

/* ---------- Cards and tables ---------- */
.panel { border: 1px solid var(--card-border); border-radius: 12px; box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.panel-header {
    display: flex; flex-wrap: wrap; gap: .75rem;
    align-items: center; justify-content: space-between;
    background: #fff; border-bottom: 1px solid var(--card-border);
    padding: .85rem 1rem; border-radius: 12px 12px 0 0 !important;
}
.panel .table { font-size: .92rem; }
.panel .table thead th {
    font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted); font-weight: 600; background: #fafbfa; white-space: nowrap;
}
.panel .table td, .panel .table th { padding-left: 1rem; padding-right: 1rem; }
.form-panel { max-width: 760px; }

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

/* ---------- Dashboard money cards ---------- */
.stat-card {
    position: relative; overflow: hidden;
    border-radius: 12px; padding: 1.1rem 1.2rem; color: #fff; min-height: 104px;
}
.stat-label { font-size: .8rem; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.45rem; font-weight: 700; margin-top: .35rem; }
.stat-icon { position: absolute; right: 1rem; bottom: .4rem; font-size: 2.8rem; opacity: .2; }
.stat-teal { background: var(--ropay-teal); }
.stat-green { background: var(--ropay-green); }
.stat-gold { background: var(--ropay-gold); color: var(--ropay-olive); }
.stat-olive { background: var(--ropay-olive); }

/* ---------- Uploads ---------- */
.upload-drop {
    display: flex; flex-direction: column; align-items: center; gap: .35rem;
    border: 2px dashed #c9d2ce; border-radius: 12px; padding: 2.2rem 1rem;
    cursor: pointer; text-align: center; background: #fafcfb;
}
.upload-drop:hover { border-color: var(--ropay-teal); background: #f1f8f9; }
.upload-drop i { font-size: 2.4rem; color: var(--ropay-green); }
.upload-drop-title { font-weight: 600; }
.upload-drop-hint { font-size: .85rem; color: var(--text-muted); }
.column-chip { background: var(--ropay-gold-light); color: var(--ropay-olive); padding: .15rem .5rem; border-radius: 6px; }
.preview-table { max-height: 60vh; overflow: auto; }

/* ---------- Search page ---------- */
.check-box-list {
    max-height: 190px; overflow: auto;
    border: 1px solid var(--card-border); border-radius: 8px; padding: .5rem .75rem; background: #fff;
}
.pos-badge { background: #e7f1f3; color: var(--ropay-teal-dark); font-weight: 500; }

/* ---------- Transfers ---------- */
.balance-box {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--ropay-gold-light); border: 1px solid #efe0a0;
    border-radius: 10px; padding: .9rem 1.1rem; color: var(--ropay-olive);
}
.balance-box strong { font-size: 1.3rem; }

/* ---------- Receipt ---------- */
.receipt { max-width: 640px; }
.receipt-logo { border-radius: 10px; background: #dcdcdc; }
.receipt-list dt { color: var(--text-muted); font-weight: 500; }

@media print {
    .app-sidebar, .app-topbar, .app-footer, .no-print, .alert { display: none !important; }
    .app-content { padding: 0; }
    .receipt { border: none; box-shadow: none; }
    body, .app-body { background: #fff; }
}

/* ---------- Sign-in and error pages ---------- */
.guest-body {
    background:
        radial-gradient(circle at 15% 20%, rgba(212, 172, 13, .18), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(11, 100, 119, .18), transparent 45%),
        var(--page-bg);
    min-height: 100vh;
}
.guest-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.login-card {
    width: 100%; max-width: 410px; background: #fff;
    border-radius: 16px; padding: 2rem 1.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .08);
    border-top: 5px solid var(--ropay-gold);
}
.login-logo { border-radius: 16px; background: #dcdcdc; }
.login-note {
    margin: 1.5rem 0 0; font-size: .8rem; color: var(--text-muted);
    background: #f5f8f7; border-radius: 8px; padding: .6rem .75rem;
}
.error-code { font-size: 3.5rem; font-weight: 800; color: var(--ropay-gold); line-height: 1; margin-bottom: .5rem; }

/* ---------- Table tools (js/tables.js) ---------- */
.table-tools {
    display: flex; flex-wrap: wrap; gap: .5rem;
    align-items: center; justify-content: space-between;
    padding: .75rem 1rem; border-bottom: 1px solid var(--card-border);
}
.table-tools-search { max-width: 260px; }
.table-pager {
    display: flex; flex-wrap: wrap; gap: .5rem;
    align-items: center; justify-content: space-between;
    padding: .65rem 1rem; border-top: 1px solid var(--card-border);
    font-size: .85rem; color: var(--text-muted);
}
.panel .table thead th.sortable { cursor: pointer; user-select: none; }
.panel .table thead th.sortable:hover { color: var(--ropay-teal); }
.panel .table thead th.sortable::after { content: " \2195"; opacity: .35; }
.panel .table thead th.sorted-up::after { content: " \2191"; opacity: 1; color: var(--ropay-teal); }
.panel .table thead th.sorted-down::after { content: " \2193"; opacity: 1; color: var(--ropay-teal); }

/* Print only the chosen table */
@media print {
    .printing-table .app-content > *:not(.panel):not(form) { display: none !important; }
    .printing-table form,
    .printing-table .table-tools,
    .printing-table .table-pager,
    .printing-table .panel-header .btn { display: none !important; }
    .printing-table .table-responsive { overflow: visible !important; max-height: none !important; }
}
.designation-name { min-width: 14rem; max-width: 22rem; }
