/*
 * File name : smsDispatch.css
 * Author    : mayuri@rtac.in
 * DOC       : 08-Sep-2026
 * Use       : Styles for §5.1 SMS Dispatch (Compose SMS + Manage
 *             Templates tabs). 
 */

/* ============================================================
   Colour tokens, scoped to the SMS Dispatch page so they never leak.
   ============================================================ */
#sectionSmsDispatch {
    --dcs-orange       : #F4623A;
    --dcs-orange-soft  : #FDEFEA;
    --dcs-orange-dark  : #E04E28;
    --dcs-indigo       : #5B4FE9;
    --dcs-indigo-soft  : #EEECFE;
    --dcs-green        : #16A34A;
    --dcs-green-soft   : #E7F6EC;
    --dcs-bg           : #F7F8FB;
    --dcs-card         : #FFFFFF;
    --dcs-border       : #EAEDF3;
    --dcs-text         : #1F2937;
    --dcs-text-muted   : #6B7280;
    --dcs-text-soft    : #9CA3AF;
    --dcs-danger-soft  : #FEE2E2;
    --dcs-danger       : #DC2626;
    --dcs-danger-dark  : #B91C1C;
    --dcs-gray-soft    : #F1F1F1;

    background: var(--dcs-bg);
    min-height: calc(100vh - 60px);
    padding: 28px 32px 40px;
}

/* ============================================================
   Header row.
   ============================================================ */
.dcSHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.dcSTitleWrap { display: flex; align-items: center; gap: 14px; }

.dcSTitleBadge {
    width: 46px; height: 46px;
    border-radius: 13px;
    background: linear-gradient(135deg, #F4623A 0%, #FF8A65 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    box-shadow: 0 6px 18px rgba(244, 98, 58, 0.30);
}

.dcSTitle {
    font-size: 22px;
    font-weight: 700;
    color: var(--dcs-text);
    margin: 0;
    line-height: 1.1;
}
.dcSSubtitle {
    font-size: 13px;
    color: var(--dcs-text-muted);
    margin: 3px 0 0;
}

/* ============================================================
   Tabs.
   ============================================================ */
.dcSTabs {
    border-bottom: 1px solid var(--dcs-border);
    margin-bottom: 0;
}
.dcSTabs .nav-link {
    color: var(--dcs-text-muted);
    font-weight: 600;
    font-size: 14px;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 4px;
    margin-right: 28px;
    background: transparent;
}
.dcSTabs .nav-link:hover { color: var(--dcs-text); }
.dcSTabs .nav-link.active {
    color: var(--dcs-orange);
    border-bottom-color: var(--dcs-orange);
    background: transparent;
}

.dcSTabContent { padding: 24px 0 0; }

/* ============================================================
   Stats KPI cards (Manage Templates tab).
   ============================================================ */
.dcSStatsRow {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.dcSStat {
    background: var(--dcs-card);
    border: 1px solid var(--dcs-border);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.dcSStat:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
    border-color: transparent;
}

.dcSStatIcon {
    width: 44px; height: 44px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.dcSStatIcon.orange { background: var(--dcs-orange-soft); color: var(--dcs-orange); }
.dcSStatIcon.indigo { background: var(--dcs-indigo-soft); color: var(--dcs-indigo); }
.dcSStatIcon.green  { background: var(--dcs-green-soft);  color: var(--dcs-green);  }

.dcSStatValue {
    font-size: 22px;
    font-weight: 700;
    color: var(--dcs-text);
    line-height: 1;
}
.dcSStatLabel {
    font-size: 12px;
    color: var(--dcs-text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* ============================================================
   Card containing toolbar + table, and the Compose form card.
   ============================================================ */
.dcSPanel {
    background: var(--dcs-card);
    border: 1px solid var(--dcs-border);
    border-radius: 14px;
    overflow: hidden;
}

.dcSComposePanel { padding: 24px; }

.dcSToolbar {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--dcs-border);
    background: var(--dcs-card);
}

.dcSActions { display: flex; gap: 8px; }

.dcSBtn {
    padding: 9px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, box-shadow .15s, transform .1s;
    border: 1px solid transparent;
}
.dcSBtn:active { transform: translateY(1px); }

.dcSBtnOutline {
    background: var(--dcs-card);
    color: var(--dcs-text);
    border-color: var(--dcs-border);
}
.dcSBtnOutline:hover { background: var(--dcs-bg); color: var(--dcs-text); }

.dcSBtnPrimary {
    background: var(--dcs-orange);
    color: #fff;
    box-shadow: 0 4px 12px rgba(244, 98, 58, 0.28);
}
.dcSBtnPrimary:hover { background: var(--dcs-orange-dark); color: #fff; }

.dcSBtnDanger {
    background: var(--dcs-danger);
    color: #fff;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.24);
}
.dcSBtnDanger:hover { background: var(--dcs-danger-dark); color: #fff; }

/* ============================================================
   Compose SMS form fields.
   ============================================================ */
.dcSLabel {
    font-size: 11px;
    font-weight: 700;
    color: var(--dcs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}
.dcSLabel .req { color: var(--dcs-orange); margin-left: 3px; }

.dcSInput,
#sectionSmsDispatch select.form-select {
    border: 1px solid var(--dcs-border) !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    background: #fff;
    transition: border .15s, box-shadow .15s;
    box-shadow: none !important;
}
.dcSInput:focus,
#sectionSmsDispatch select.form-select:focus {
    outline: none !important;
    border-color: var(--dcs-orange) !important;
    box-shadow: 0 0 0 3px rgba(244, 98, 58, 0.12) !important;
}
.dcSInput[readonly] { background: var(--dcs-bg); color: var(--dcs-text-muted); }

/* Balance / rate line under Estimated Cost; red when the balance does
   not cover the estimate. */
.dcSFieldHint { font-size: 12px; color: var(--dcs-text-muted); margin-top: 5px; }
.dcSFieldHint.dcSLow { color: var(--dcs-danger); font-weight: 600; }
textarea.dcSInput { resize: vertical; }

/* bootstrap-select styling for the Choose Campaign / Choose Template pickers */
#sectionSmsDispatch .bootstrap-select > .dropdown-toggle {
    border: 1px solid var(--dcs-border) !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    background: #fff !important;
    font-size: 14px !important;
    box-shadow: none !important;
    height: auto !important;
}
#sectionSmsDispatch .bootstrap-select.show > .dropdown-toggle {
    border-color: var(--dcs-orange) !important;
    box-shadow: 0 0 0 3px rgba(244, 98, 58, 0.12) !important;
}

.dcSComposeActions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
}

.dcSScheduleBanner {
    background: var(--dcs-orange-soft);
    color: var(--dcs-orange);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 18px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   Templates table.
   ============================================================ */
#smsTemplatesTable { margin: 0 !important; }

#smsTemplatesTable thead th {
    background: #FAFBFC;
    border-bottom: 1px solid var(--dcs-border);
    border-top: none;
    font-size: 11px;
    font-weight: 700;
    color: var(--dcs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 20px;
}

#smsTemplatesTable tbody td {
    padding: 14px 20px;
    border-top: 1px solid var(--dcs-border);
    vertical-align: middle;
    font-size: 14px;
    color: var(--dcs-text);
    background: transparent;
}
#smsTemplatesTable tbody tr:first-child td { border-top: none; }
#smsTemplatesTable tbody tr { transition: background .12s; }
#smsTemplatesTable tbody tr:hover { background: #FAFBFC; }

.dcSTemplateName { font-weight: 600; color: var(--dcs-text); font-size: 14px; }

.dcSMuted { color: var(--dcs-text-soft); font-size: 13px; }

.dcSBadgeActive   { background: var(--dcs-green-soft); color: var(--dcs-green); }
.dcSBadgeInactive { background: var(--dcs-gray-soft);  color: var(--dcs-text-muted); }

/* ============================================================
   Row actions - lift, tinted ring, colour shift (matches Groups).
   ============================================================ */
.dcSRowActions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.dcSIconBtn {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center; justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--dcs-text-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease,
                transform .12s ease, box-shadow .15s ease;
    font-size: 15px;
}
.dcSIconBtn:hover { transform: translateY(-1px); }
.dcSIconBtn:active { transform: translateY(0) scale(0.94); }

.dcSIconBtn.edit:hover {
    background: var(--dcs-indigo-soft);
    color: var(--dcs-indigo);
    border-color: rgba(91, 79, 233, 0.18);
    box-shadow: 0 3px 10px rgba(91, 79, 233, 0.18);
}
.dcSIconBtn.danger:hover {
    background: var(--dcs-danger-soft);
    color: var(--dcs-danger);
    border-color: rgba(220, 38, 38, 0.18);
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.16);
}
.dcSIconBtn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.dcSIconBtn:disabled:hover {
    transform: none;
    background: transparent;
    color: var(--dcs-text-muted);
    border-color: transparent;
    box-shadow: none;
}

/* ============================================================
   Loading skeleton (shown while getTemplateList.php is in flight,
   and reused on the Compose tab while getSMSDispatchFormMeta.php
   loads).
   ============================================================ */
.dcSSkeleton { padding: 6px 20px; }
.dcSComposePanel .dcSSkeleton { padding: 6px 0; }

.dcSSkeletonRow {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 0;
    border-top: 1px solid var(--dcs-border);
}
.dcSSkeletonRow:first-child { border-top: none; }

.dcSSkelBar {
    height: 13px;
    border-radius: 6px;
    background: linear-gradient(90deg, #EEF0F4 25%, #F6F7FA 37%, #EEF0F4 63%);
    background-size: 400% 100%;
    animation: dcSShimmer 1.4s ease infinite;
}
.dcSSkelBar.w40 { flex: 0 0 38%; }
.dcSSkelBar.w20 { flex: 0 0 20%; }
.dcSSkelBar.w18 { flex: 0 0 18%; }
.dcSSkelBar.w12 { flex: 0 0 12%; }
.dcSSkelBar.w15 { flex: 0 0 9%; }
.dcSSkelBar.center { margin: 0 auto; }
.dcSSkelBar.end { margin-left: auto; }

@keyframes dcSShimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
    .dcSSkelBar { animation: none; }
}

/* ============================================================
   DataTables footer.
   ============================================================ */
#smsTemplatesTableWrap .dataTables_wrapper .dataTables_info,
#smsTemplatesTableWrap .dataTables_wrapper .dataTables_paginate {
    padding: 14px 20px !important;
    color: var(--dcs-text-muted);
    font-size: 13px;
}
#smsTemplatesTableWrap .dataTables_wrapper .paginate_button {
    border-radius: 8px !important;
    margin: 0 2px !important;
    font-size: 13px !important;
    border: 1px solid transparent !important;
    padding: 5px 11px !important;
}
#smsTemplatesTableWrap .dataTables_wrapper .paginate_button.current,
#smsTemplatesTableWrap .dataTables_wrapper .paginate_button.current:hover {
    background: var(--dcs-orange) !important;
    border-color: var(--dcs-orange) !important;
    color: #fff !important;
}
#smsTemplatesTableWrap .dataTables_wrapper .paginate_button:hover {
    background: var(--dcs-bg) !important;
    border-color: var(--dcs-border) !important;
    color: var(--dcs-text) !important;
}

/* ============================================================
   Empty state.
   ============================================================ */
.dcSEmpty { padding: 72px 20px; text-align: center; }
.dcSEmptyIcon {
    width: 84px; height: 84px;
    background: var(--dcs-orange-soft);
    color: var(--dcs-orange);
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    margin-bottom: 20px;
}
.dcSEmptyTitle {
    font-size: 18px;
    font-weight: 700;
    color: var(--dcs-text);
    margin-bottom: 4px;
}
.dcSEmptySub {
    color: var(--dcs-text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}
.dcSEmptyActions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================
   Add / Edit + Delete modals.
   ============================================================ */
#modalTemplateForm .modal-content,
#modalTemplateDelete .modal-content,
#smsScheduleModal .modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.18);
}
#modalTemplateForm .modal-header,
#modalTemplateDelete .modal-header,
#smsScheduleModal .modal-header {
    background: #fff;
    border-bottom: 1px solid var(--dcs-border);
    padding: 18px 24px;
}
#modalTemplateForm .modal-title,
#modalTemplateDelete .modal-title,
#smsScheduleModal .modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--dcs-text);
    display: flex;
    align-items: center;
    gap: 10px;
}
#modalTemplateForm .modal-title .dcSModalIcon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--dcs-orange-soft);
    color: var(--dcs-orange);
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 16px;
}
#modalTemplateForm .modal-body,
#modalTemplateDelete .modal-body,
#smsScheduleModal .modal-body {
    padding: 22px 24px;
    font-size: 14px;
    color: var(--dcs-text);
}
#modalTemplateForm .modal-footer,
#modalTemplateDelete .modal-footer,
#smsScheduleModal .modal-footer {
    background: #FAFBFC;
    border-top: 1px solid var(--dcs-border);
    padding: 14px 24px;
}

.dcSSwitch .form-check-input:checked {
    background-color: var(--dcs-orange);
    border-color: var(--dcs-orange);
}
.dcSSwitch .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(244, 98, 58, 0.12);
}

/* ============================================================
   Responsive.
   ============================================================ */
@media (max-width: 992px) {
    .dcSStatsRow { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    #sectionSmsDispatch { padding: 20px 16px 32px; }
    .dcSToolbar { flex-direction: column; align-items: stretch; }
    .dcSActions { justify-content: stretch; }
    .dcSActions .dcSBtn { flex: 1; justify-content: center; }
    .dcSComposeActions { flex-direction: column; }
}