@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

:root {
    --bg:            #f0f2f5;
    --surface:       #ffffff;
    --surface2:      #f7f8fa;
    --border:        #e4e7ec;
    --accent:        #1a56db;
    --accent-light:  #eef3ff;
    --accent-hover:  #1648c0;
    --text:          #111827;
    --text-muted:    #6b7280;
    --text-light:    #9ca3af;
    --green:         #059669;
    --green-bg:      #ecfdf5;
    --amber:         #d97706;
    --amber-bg:      #fffbeb;
    --red:           #dc2626;
    --red-bg:        #fef2f2;
    --radius:        10px;
    --shadow:        0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:     0 4px 12px rgba(0,0,0,0.08);

    /* legacy aliases used elsewhere in the app */
    --tanyya-blue:       #1a56db;
    --dark-blue:         #1648c0;
    --light-blue:        #eef3ff;
    --light-gray:        #e4e7ec;
    --background-gray:   #f0f2f5;
    --success-green:     #059669;
    --warning-amber:     #d97706;
    --error-red:         #dc2626;
}

/* ── BASE ─────────────────────────────────────────────── */
body {
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.bg-blue-700  { background-color: var(--accent); }
.border-gray-200 { border-bottom: 1px solid var(--border); }
.font-semibold { font-weight: 500; }

/* ── LAYOUT ───────────────────────────────────────────── */
.wrapper, .main { background: transparent; }
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}
.content { padding: 28px; background: var(--bg); }

/* ── LOGIN ────────────────────────────────────────────── */
.login-bg {
    background: linear-gradient(to bottom right, rgba(30,170,221,0.1), rgba(0,0,255,0.1)),
                url('../img/photos/miller-cover.webp');
    background-blend-mode: overlay;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.login-main { position: absolute; bottom: 20px; }
.login-pannel-start {
    background-color: #1EAAE7;
    border-radius: 5px;
    min-height: 400px;
}
.login-pannel-start h1 {
    font-size: 40px;
    line-height: 1.2;
    font-weight: 500;
    margin: 0 auto 1.4rem;
    color: #fff;
    text-align: center;
    padding: 30px 25px 10px;
    position: relative;
    z-index: 9;
}
.login-pannel-start .text {
    padding: 0 30px;
    margin: 0 auto 15px;
    color: #fff;
    opacity: 0.8;
    font-size: 16px;
}
.login-contact {
    font-weight: 500;
    line-height: 1.2;
    color: #fff;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    font-size: 20px;
}
.login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 40px;
    margin-bottom: 20px;
    color: #fff;
    opacity: 0.85;
}
.login-divider span {
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.5);
}
.login-tagline {
    text-align: center;
    color: #0b2540;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.3px;
    margin: 0 auto 12px;
    padding: 0 20px;
}
.login-location {
    text-align: center;
    color: #fff;
    font-weight: 600;
    font-size: 17px;
    margin: 0 auto 20px;
}
.login-location i { margin-right: 6px; }
.login-pannel-start .text {
    text-align: center;
    font-size: 17px;
}
.login-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 20px 28px;
    padding: 24px 15px 30px;
    margin-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.35);
}
.login-footer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}
.login-footer-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: #fff;
    color: #0b3d91;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.login-footer-text {
    font-size: 14px;
    line-height: 1.4;
}
.login-footer-text strong { font-size: 16px; }
.login-form {
    width: 300px;
    min-height: 400px;
    background-color: var(--surface);
    border-radius: var(--radius);
}
.alert-danger {
    color: var(--bs-form-invalid-color);
    font-size: 80%;
    margin-top: .25rem;
    width: 100%;
}
.profile-image {
    width: 128px;
    height: 128px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    text-shadow: 5px 1px #ccc;
    letter-spacing: 5px;
}

/* ── SIDEBAR ──────────────────────────────────────────── */
.sidebar .dropdown-toggle::after { content: none; }
#sidebar { position: sticky; }
.wrapper .main { padding: 0; }
#sidebar.collapsed + .main { margin-left: 0; padding: 0; }

.sidebar-content {
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.sidebar-link, a.sidebar-link {
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    margin: 1px 6px;
    transition: all 0.15s;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-muted);
    background: transparent;
    text-decoration: none;
}
.sidebar-link:hover, a.sidebar-link:hover {
    background: var(--surface2);
    color: var(--text);
}
.sidebar-link i, .sidebar-link svg,
a.sidebar-link i, a.sidebar-link svg {
    color: var(--text-muted) !important;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-item.active .sidebar-link,
.sidebar-item.active a.sidebar-link,
.sidebar-item:hover a.sidebar-link,
.sidebar-item.active .sidebar-link:hover {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}
.sidebar-item.active .sidebar-link i,
.sidebar-item.active a.sidebar-link i {
    color: var(--accent) !important;
}

/* ── PAGE HEADINGS ────────────────────────────────────── */
.page-title {
    font-size: 22px;
    font-weight: 500;
    color: var(--text);
    letter-spacing: -0.2px;
    margin-bottom: 24px;
}
.section-title, h1.h1 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}
.tab-pane .section-title { margin: 24px 0 8px; }

/* ── TABS ─────────────────────────────────────────────── */
.nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    background: var(--surface);
    padding: 0 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-item .nav-link {
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--text-muted);
    background: transparent;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.nav-item .nav-link:hover { color: var(--text); }
.nav-tabs .nav-item .nav-link.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    font-weight: 600;
    background: transparent;
}

/* ── TABLE ────────────────────────────────────────────── */
.table {
    background-color: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}
.table > thead { background: var(--surface2); }

table thead th {
    padding: 10px 16px !important;
    background-color: var(--surface2);
    border: 0;
    font-weight: 600;
    font-size: 11px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--border);
}
table tbody tr td {
    padding: 12px 16px !important;
    border: 0;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text) !important;
    font-size: 13.5px;
    transition: background-color 0.15s ease;
}
table tbody tr:last-child td { border-bottom: none; }
table.table-hover tbody tr:hover {
    background-color: var(--surface2);
    --bs-table-accent-bg: none !important;
}
.table-striped > tbody > tr:nth-of-type(odd) {
    --bs-table-accent-bg: #fff;
    color: var(--text);
}
table thead tr { border: 0; }
.table > :not(caption) > * > * { padding: 0.65rem 1rem; }

/* ── BADGES ───────────────────────────────────────────── */
td .bg-success {
    background-color: var(--green-bg) !important;
    color: var(--green);
    width: 85px;
}
td .bg-secondary {
    background-color: #e2e8f0 !important;
    color: #64748b;
    width: 85px;
}
td .badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 15px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.btn.btn-primary {
    background-color: var(--accent);
    color: #fff;
    border: none;
    padding: 7px 15px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    transition: background-color 0.15s ease;
    width: fit-content;
}

.btn.btn-primary:hover { background-color: var(--accent-hover); color: #fff; }

.btn-warning { background-color: var(--amber); color: #fff; border: none; }
.btn-outline-secondary {
    border-color: var(--border);
    color: var(--text);
    background: var(--surface);
}
.btn-outline-secondary:hover { background: var(--surface2); }

td .btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: none;
}
td .btn.btn-primary {
    padding: 5px 12px;
}

button[type='button'].close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 26px;
    line-height: 20px;
}

/* ── MODAL ────────────────────────────────────────────── */
.modal-footer .btn-secondary {
    background-color: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.modal-footer .btn-secondary:hover {
    background-color: var(--surface2);
    color: var(--text) !important;
    border: 1px solid var(--border);
}
.modal-footer .btn.btn-primary {
    background-color: var(--accent);
    color: #fff;
    border: none;
}
.modal-content {
    background-color: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border);
}
.modal-header {
    background-color: var(--accent);
    padding: 14px 20px;
}
.modal-header .modal-title {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}
.modal-body h4.text-muted {
    color: var(--text-muted) !important;
    font-size: 14px;
    margin: 24px auto;
}
.btn-close { opacity: 1; filter: invert(1); }

/* ── FORMS ────────────────────────────────────────────── */
.form-label, label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
.form-control, .form-select {
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--surface2);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.15s, background 0.15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.08);
    outline: none;
}

/* ── DATATABLES ───────────────────────────────────────── */
.dataTables_filter, .pagination { float: right; margin-bottom: 10px; }
.dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
}
.dataTables_filter input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 13px;
    background: var(--surface2);
    outline: none;
    transition: border-color 0.15s;
}
.dataTables_filter input:focus { border-color: var(--accent); background: var(--surface); }

.pagination { display: flex; align-items: center; gap: 4px; }
.page-item .page-link {
    border-radius: 6px !important;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    padding: 4px 10px;
}
.page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* DataTables sort icons */
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after {
    content: "";
    display: inline-block;
    margin-left: 6px;
    font-family: 'bootstrap-icons';
    font-weight: normal;
    font-style: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    speak: never;
}
table.dataTable thead th.sorting:after      { content: "\f127"; }
table.dataTable thead th.sorting_asc:after  { content: "\f148"; }
table.dataTable thead th.sorting_desc:after { content: "\f128"; }

/* ── CARD ─────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }

/* ── MISC ─────────────────────────────────────────────── */
.custom-toast { right: 0; top: 80px; }
.btn.remove-buyer, .btn.remove-product { padding: 5px 10px; }
#add-buyer.btn, .add-product.btn { padding: 5px 10px; }
.payment_update_div .col-auto { min-width: 16px; }
.max-width-150 { width: 150px !important; }
.logdetailsroe { font-size: 13px; }

table#logTable b, table#logTable strong {
    background: var(--accent-light);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 15px;
}
table#logTable hr:not([size]) { padding: 0; margin: 3px 0; }

/* ── DATALIST / BOOTSTRAP-SELECT ─────────────────────── */
.datalist-wrapper { position: relative; display: inline-block; width: 100%; }
.datalist-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--surface2);
    appearance: none;
    transition: border-color 0.15s;
}
.datalist-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.08);
}
.datalist-wrapper::after {
    content: "▼";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
    font-size: 11px;
}
.dropdown-wrapper { position: relative; width: 100%; max-width: 300px; }
.dropdown-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--surface2);
    cursor: pointer;
}
.bootstrap-select:not([class*=col-]):not([class*=form-control]):not(.input-group-btn) {
    width: 100%;
    padding: 0;
    height: 38px;
}
.bootstrap-select > .dropdown-toggle { height: 38px !important; background: transparent; }
.dropdown-toggle:after { display: none; }
.bootstrap-select > .dropdown-toggle.bs-placeholder,
.bootstrap-select > .dropdown-toggle.bs-placeholder:active,
.bootstrap-select > .dropdown-toggle.bs-placeholder:focus,
.bootstrap-select > .dropdown-toggle.bs-placeholder:hover {
    background: transparent !important;
    height: 38px;
}

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 992px) {
    .login-main { position: unset; }
    .login-pannel-start { display: none; }
    .login-form { width: 100%; max-width: 400px; }
}
@media (max-width: 768px) {
    .content { padding: 20px 16px; }
}
