/* Additions for the Django version of PayDesk */
a { color: var(--blue); }

/* Links that look like buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.45;
    white-space: nowrap;
}
.btn-light:hover { background: #e2eaf5 }
.btn-danger:hover { background: #ffe3e3 }
.btn-success:hover { background: #dcf2e6 }
.btn-block { width: 100% }
.row-actions a.btn,
.row-actions button { padding: 6px 9px; font-size: 11px }
.row-actions form { margin: 0; display: inline }
.toolbar form { margin: 0 }
button:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed }

/* Sidebar nav links */
.nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    color: #d7e4f4;
    margin: 3px 0;
    padding: 12px;
    border-radius: 10px;
    font-weight: 550;
    text-decoration: none;
}
.nav a.active, .nav a:hover { background: #ffffff1c; color: #fff }
.side-user {
    margin: 22px 7px 0;
    padding: 13px;
    border-radius: 12px;
    background: #ffffff12;
    color: #d7e4f4;
    font-size: 12px;
}
.side-user strong { display: block; color: #fff; font-size: 13px }
.side-user .links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px }
.side-user a, .side-user button {
    color: #b8cbe2;
    background: none;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    text-decoration: underline;
}
.side-user form { margin: 0 }
.sidebar-backdrop { display: none }
@media (max-width:700px) {
    .sidebar { overflow-y: auto }
    .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: #0006; z-index: 9 }
}

/* Forms */
.field .helptext, .field .help { font-size: 11px; color: var(--muted) }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: #e7a2a5 }
.errorlist { list-style: none; margin: 2px 0 0; padding: 0; color: var(--red); font-size: 12px; font-weight: 600 }
.errorlist.nonfield { margin-bottom: 12px }
.field-check { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; margin: 12px 0 }
.field-check input { margin-top: 3px }
.form-errors {
    padding: 12px 14px;
    background: #fff0f0;
    border: 1px solid #f5c9cb;
    border-radius: 10px;
    color: #9b2c31;
    font-size: 12px;
    margin: 0 0 14px;
}
.form-errors ul { margin: 6px 0 0; padding-left: 18px }
.search-tools select.search { min-width: 150px; width: auto }

/* Pop-up dialogs */
dialog.modal {
    border: 0;
    border-radius: 16px;
    padding: 0;
    width: min(960px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    box-shadow: 0 24px 70px #0b2a5059;
    color: var(--ink);
    background: #fff;
}
dialog.modal::backdrop { background: #0b2a5080 }
dialog.modal > form { display: flex; flex-direction: column; max-height: calc(100vh - 40px) }
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 17px }
.modal-head button { padding: 6px 11px }
.modal-body { padding: 18px 22px; overflow-y: auto }
.modal-body .notice { margin-bottom: 0 }
.modal-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 22px;
    border-top: 1px solid var(--line);
    background: #f8fafd;
    font-size: 12px;
}
@media (max-width:700px) {
    dialog.modal { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; margin: 0 }
    dialog.modal > form { max-height: 100vh; height: 100% }
    .modal-body { flex: 1 }
    .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px }
}

/* Restored-draft notice on Bulk Payments */
.draft-notice { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap }
.draft-notice .btn-light { padding: 7px 12px; font-size: 12px }

/* IFSC auto-fill */
.ifsc-input { text-transform: uppercase; letter-spacing: .5px }
.ifsc-input::placeholder { text-transform: none; letter-spacing: 0 }
.ifsc-status.ok { color: var(--green); font-weight: 600 }
.ifsc-status.warn { color: #a95b0c; font-weight: 600 }
.link-button {
    background: none;
    padding: 0;
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
    text-decoration: underline;
}
@keyframes autofill-flash { from { background: #e8f7ef } to { background: #fff } }
.field input.autofilled { animation: autofill-flash 1.6s ease-out }
.inline-upload { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 }

/* Tables */
td input[type=number], td input[type=text] {
    padding: 8px;
    border: 1px solid #dce3ec;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
}
td input.amount-input { width: 130px }
td input.remark-input { width: 210px }
td input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px #c43d431a }
tr.is-selected td { background: #f5f9ff }
tfoot td { font-weight: 800; background: #f8fafd }
.text-right { text-align: right }
.nowrap { white-space: nowrap }
.table-wrap.tall { max-height: 520px }
.table-wrap.tall thead th { position: sticky; top: 0; z-index: 1 }

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    font-size: 12px;
    color: var(--muted);
    flex-wrap: wrap;
}
.pagination .pages { display: flex; gap: 6px }
.pagination .btn { padding: 7px 11px; font-size: 12px }

/* Toasts (Django messages) */
.toast-stack {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 20;
    display: grid;
    gap: 8px;
    max-width: 380px;
}
.toast-stack .toast {
    position: static;
    display: block;
    max-width: none;
    transition: opacity .3s;
}
.toast.error { background: #8e2328 }
.toast.warning { background: #8d4c13 }
.toast.success { background: #145c3a }
.toast button.close { float: right; background: none; color: #fff; padding: 0 0 0 12px; font-size: 16px; line-height: 1 }
@media (max-width:700px) { .toast-stack { left: 12px; right: 12px; bottom: 12px; max-width: none } }

/* Detail summaries */
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px }
@media (max-width:1000px) { .summary-grid { grid-template-columns: 1fr } }
.summary-line > span:first-child { color: var(--muted) }
.summary-line > *:last-child { text-align: right }

.danger-zone { border-color: #f5c9cb }
.danger-zone h3 { color: var(--red) }

/* Auth pages */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: linear-gradient(180deg, #123b70, #0b2a50);
}
.auth-card {
    background: #fff;
    border-radius: 18px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px #0004;
}
.auth-card .brand { padding: 0 0 20px; color: var(--ink) }
.auth-card .brand small { color: var(--muted) }
.auth-card h2 { margin: 0 0 4px; font-size: 20px }
.auth-card .field { margin-top: 13px }

/* Voucher / print */
@media print {
    .no-print, .pagination, .search-tools, .side-user, .toast-stack { display: none !important }
    a { color: inherit; text-decoration: none }
    .table-wrap { overflow: visible; border: 0 }
    table { min-width: 0 }
}
