/* ==========================================================================
   Skysoft SMS – polish layer  (load AFTER theme.css and superadmin.css)
   Buttons, tables, forms, badges, modals. Dashboard cards and charts are
   intentionally NOT touched here. Uses `body` prefixes so it wins over page-level <style>.
   ========================================================================== */

:root {
    --p-radius: 10px;
    --p-radius-lg: 14px;
    --p-ease: cubic-bezier(.4, 0, .2, 1);
    --p-shadow-1: 0 1px 2px rgba(46, 50, 80, .06), 0 1px 3px rgba(46, 50, 80, .05);
    --p-shadow-2: 0 6px 18px rgba(46, 50, 80, .10);
    --p-shadow-3: 0 14px 32px rgba(46, 50, 80, .14);
    --p-ring: 0 0 0 3px rgba(132, 79, 193, .25);
}


/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c9cde0 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c9cde0; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #a3a8c0; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
body .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .5rem 1rem; font-size: .85rem; font-weight: 600; line-height: 1.25;
    border-radius: var(--p-radius); border-width: 1px;
    transition: background-color .18s var(--p-ease), border-color .18s var(--p-ease),
                color .18s var(--p-ease), box-shadow .18s var(--p-ease), transform .12s var(--p-ease);
    cursor: pointer; user-select: none; white-space: nowrap;
}
body .btn i, body .btn .fas, body .btn .far { font-size: .9em; line-height: 1; }
body .btn-sm { padding: .32rem .7rem; font-size: .78rem; border-radius: 8px; gap: .35rem; }
body .btn-lg { padding: .75rem 1.4rem; font-size: 1rem; border-radius: 12px; }
body .btn:hover:not(:disabled):not(.disabled) { transform: translateY(-1px); box-shadow: var(--p-shadow-2); }
body .btn:active:not(:disabled):not(.disabled) { transform: translateY(0); box-shadow: none; }
body .btn:focus-visible { outline: 0; box-shadow: var(--p-ring) !important; }
body .btn:disabled, body .btn.disabled, body fieldset:disabled .btn {
    opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; pointer-events: none;
}

/* solid variants – subtle gradient + coloured glow */
body .btn-primary, body .btn.btn-primary {
    background: linear-gradient(180deg, #9060cb, #844fc1) !important; border-color: #7a46b6 !important; color: #fff !important;
}
body .btn-primary:hover { background: linear-gradient(180deg, #844fc1, #6a3fa0) !important; border-color: #6a3fa0 !important; box-shadow: 0 8px 20px rgba(132, 79, 193, .35); }
body .btn-success, body .btn.btn-success { background: linear-gradient(180deg, #2fd114, #21bf06) !important; border-color: #1ca905 !important; color: #fff !important; }
body .btn-success:hover { background: linear-gradient(180deg, #21bf06, #1a9e05) !important; box-shadow: 0 8px 20px rgba(33, 191, 6, .32); }
body .btn-danger, body .btn.btn-danger { background: linear-gradient(180deg, #e0485c, #d13449) !important; border-color: #bf2b3f !important; color: #fff !important; }
body .btn-danger:hover { background: linear-gradient(180deg, #d13449, #b0283b) !important; box-shadow: 0 8px 20px rgba(209, 52, 73, .32); }
body .btn-warning, body .btn.btn-warning { background: linear-gradient(180deg, #f7a82e, #f49915) !important; border-color: #e08c0f !important; color: #fff !important; }
body .btn-warning:hover { background: linear-gradient(180deg, #f49915, #dd8408) !important; box-shadow: 0 8px 20px rgba(244, 153, 21, .32); }
body .btn-info, body .btn.btn-info { background: linear-gradient(180deg, #4f97de, #3b86d1) !important; border-color: #3279c2 !important; color: #fff !important; }
body .btn-info:hover { background: linear-gradient(180deg, #3b86d1, #2c6aa8) !important; box-shadow: 0 8px 20px rgba(59, 134, 209, .32); }
body .btn-secondary { background: #6c7293 !important; border-color: #6c7293 !important; color: #fff !important; }
body .btn-secondary:hover { background: #555b7a !important; border-color: #555b7a !important; }
body .btn-light, body .btn-default { background: #fff; border: 1px solid var(--line-strong); color: var(--graphite); }
body .btn-light:hover, body .btn-default:hover { background: var(--blue-50); border-color: var(--blue); color: var(--blue); }

/* outline variants – fill on hover, one consistent rule set */
body .btn-outline-primary { color: var(--blue); border-color: var(--blue); background: transparent; }
body .btn-outline-primary:hover { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(132, 79, 193, .30); }
body .btn-outline-success { color: #1a9e05; border-color: #21bf06; background: transparent; }
body .btn-outline-success:hover { background: #21bf06; color: #fff; box-shadow: 0 6px 16px rgba(33, 191, 6, .28); }
body .btn-outline-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
body .btn-outline-danger:hover { background: var(--danger); color: #fff; box-shadow: 0 6px 16px rgba(209, 52, 73, .28); }
body .btn-outline-warning, body .btn-outline-gold { color: #b9720a; border-color: #dd8408; background: transparent; }
body .btn-outline-warning:hover, body .btn-outline-gold:hover { background: #dd8408; color: #fff; box-shadow: 0 6px 16px rgba(221, 132, 8, .28); }
body .btn-outline-secondary { color: var(--slate); border-color: var(--line-strong); background: transparent; }
body .btn-outline-secondary:hover { background: var(--slate); border-color: var(--slate); color: #fff; }

/* icon-only + groups + loading */
body .btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
body .btn-icon.btn-sm { width: 30px; height: 30px; }
body .btn-group > .btn { transform: none !important; }
body .btn-group > .btn:not(:first-child) { margin-left: -1px; }
body .btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
body .btn.is-loading::after {
    content: ""; position: absolute; width: 1em; height: 1em; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: p-spin .7s linear infinite;
}
@keyframes p-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   
   ========================================================================== */
/* ==========================================================================
   TABLES, FORMS, BADGES, MODALS
   ========================================================================== */

body .table { margin-bottom: 0; }
body .table > :not(caption) > * > * { padding: .75rem 1rem; vertical-align: middle; }
body .table thead th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
    background: var(--porcelain); border-bottom: 1px solid var(--line-strong); color: var(--ink-muted);
}
body .table tbody tr { transition: background-color .15s var(--p-ease); }
body .table-responsive { border: 1px solid var(--line); border-radius: var(--p-radius); background: #fff; }
body .table-responsive > .table { margin: 0; }

body .form-control, body .form-select, body select, body textarea,
body input[type="text"], body input[type="email"], body input[type="number"], body input[type="date"],
body input[type="password"], body input[type="search"], body input[type="tel"], body input[type="time"] {
    min-height: 40px; border-radius: var(--p-radius); font-size: .88rem; transition: border-color .18s, box-shadow .18s;
}
body textarea.form-control, body textarea { min-height: 96px; }
body .form-control:focus, body .form-select:focus, body select:focus, body textarea:focus, body input:focus {
    border-color: var(--blue); box-shadow: var(--p-ring); outline: 0;
}
body .form-control:disabled, body .form-select:disabled, body input:disabled, body select:disabled { background: var(--butter-50); color: var(--ink-faint); cursor: not-allowed; }
body .form-label, body label { font-size: .82rem; margin-bottom: .3rem; }
body .is-invalid { border-color: var(--danger) !important; }
body .invalid-feedback { font-size: .78rem; }

body .badge { padding: .35em .7em; border-radius: 999px; font-size: .72rem; letter-spacing: .02em; }

body .modal-content { border-radius: var(--p-radius-lg); overflow: hidden; }
body .modal-header, body .modal-footer { padding: 1rem 1.25rem; }
body .modal-body { padding: 1.25rem; }
body .modal-backdrop.show { opacity: .45; backdrop-filter: blur(2px); }
body .dropdown-menu { padding: .4rem; }
body .dropdown-item { border-radius: 6px; padding: .5rem .75rem; }
body .alert { border-radius: var(--p-radius); padding: .85rem 1.1rem; }

/* sidebar polish */
body .sidebar .nav-header, body .sidebar .direct-link { border-radius: 8px; transition: background-color .15s, color .15s; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    body .table > :not(caption) > * > * { padding: .6rem .75rem; }
    body .btn:not(.btn-sm) { min-height: 42px; }   /* comfortable touch targets */
}
@media (max-width: 480px) {
    body .modal-dialog { margin: .5rem; }
}

/* accessibility + print */
@media print {
    body .btn, body .sidebar, body .top-bar { display: none !important; }
}

/* ==========================================================================
   SMALL-SCREEN RESPONSIVENESS
   Phones/tablets only – desktop look is untouched. Layout fixes only: no
   colours, shadows or sizes of the dashboard cards/graphs are restyled.
   ========================================================================== */
@media (max-width: 992px) {
    body { overflow-x: hidden; }
    body img, body video, body iframe { max-width: 100%; height: auto; }
    body canvas { max-width: 100% !important; }
    body .chart-container, body .stat-card, body .stat-card-link { min-width: 0; }
    body .row > [class*="col-"] { min-width: 0; }
}
@media (max-width: 768px) {
    /* page padding + wide content scrolls inside its own box, never the page */
    body .content { padding-left: .5rem; padding-right: .5rem; }
    body .card, body .custom-card, body .panel, body .box, body .card-body { max-width: 100%; overflow-x: auto; }
    body .table-responsive, body .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    body .table-responsive > .table, body .card-body > .table { margin-bottom: 0; }

    /* forms stack and use full width */
    body .form-row > *, body .filter-group, body .form-inline > * { flex: 1 1 100%; max-width: 100%; }
    body form .btn, body .modal-footer .btn { flex: 1 1 auto; }
    body .input-group { flex-wrap: nowrap; }
    body input, body select, body textarea { font-size: 16px; }   /* stops iOS zoom-on-focus */

    /* button rows wrap instead of overflowing */
    body .btn-toolbar, body .page-actions, body .profile-actions, body .actions { flex-wrap: wrap; gap: .5rem; }
    body .btn { white-space: normal; }

    /* modals fit the screen and scroll */
    body .modal-dialog { max-width: calc(100% - 1rem); margin: .5rem auto; }
    body .modal-body { max-height: calc(100vh - 11rem); overflow-y: auto; }

    /* top bar + menus never leave the screen */
    body .lang-menu, body .profile-menu { max-width: calc(100vw - 1rem); }
    body .top-bar { padding-left: .75rem; padding-right: .75rem; }
    body .top-bar-left h5 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45vw; }
    body .nav-tabs, body .nav-pills { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; white-space: nowrap; }
    body .nav-tabs .nav-link, body .nav-pills .nav-link { flex: 0 0 auto; }
    body h1 { font-size: 1.6rem; } body h2 { font-size: 1.4rem; } body h3 { font-size: 1.2rem; }
}
@media (max-width: 480px) {
    body .content { padding-left: .35rem; padding-right: .35rem; }
    body .btn-group { flex-wrap: wrap; }
    body .pagination { flex-wrap: wrap; justify-content: center; }
    body .footer { text-align: center; padding-left: .75rem; padding-right: .75rem; }
}

/* ==========================================================================
   MODULES – shared responsive fixes (screen only, so printing is unaffected)
   ========================================================================== */
@media screen and (max-width: 768px) {
    /* any table without its own wrapper scrolls sideways instead of breaking the page */
    body .content table, body .sms-wrap table, body .sa-wrap table {
        display: block; width: 100%; max-width: 100%; min-width: 0 !important;
        overflow-x: auto; -webkit-overflow-scrolling: touch;
    }
    body .content table th, body .content table td { white-space: nowrap; }
    body .content table td.wrap, body .content table td .btn { white-space: normal; }

    /* fixed multi-column module layouts collapse to one column */
    body .two-col, body .form-grid, body .modal-box .form-grid, body .next-term-row,
    body .ie-grid, body .receipt-summary, body .social-grid, body .rc-layout {
        grid-template-columns: 1fr !important;
    }
    body .summary-cards, body .stats-grid, body .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

    /* shared helper classes (core/ui.php) */
    body .sms-wrap, body .sa-wrap { padding-left: .6rem; padding-right: .6rem; }
    body .sms-page-head, body .sa-hero { flex-direction: column; align-items: stretch; }
    body .sms-actions, body .sa-actions { width: 100%; }
    body .sms-actions > *, body .sa-actions > * { flex: 1 1 auto; justify-content: center; }
    body .sms-btn, body .sa-btn { min-height: 40px; justify-content: center; }
    body .sms-grid.c2, body .sa-grid.c2 { grid-template-columns: 1fr; }
    body .sa-split { grid-template-columns: 1fr; }
    body .sms-tabs, body .sa-tabs { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; }

    /* sticky/inline toolbars and filters wrap */
    body .filter-bar, body .summary-strip, body .lt-row, body .toolbar { flex-direction: column; align-items: stretch; }
    body .filter-bar > *, body .lt-row > *, body .lt-field { flex: 1 1 100%; min-width: 0; }
    body .modal-box { width: calc(100vw - 1rem); max-width: calc(100vw - 1rem); max-height: 92vh; overflow-y: auto; }
    body iframe { max-width: 100%; }
}
@media screen and (max-width: 480px) {
    body .summary-cards, body .stats-grid, body .video-grid { grid-template-columns: 1fr !important; }
    body .receipt-summary { grid-template-columns: 1fr 1fr !important; }
}
