/**
 * NurseryLive OMS — Custom CSS Overrides
 * AdminLTE 3.x customizations for NurseryLive branding
 */

/* =============================================
   1. BRAND & COLOR OVERRIDES
   ============================================= */

:root {
    --nl-green:       #2d6a4f;
    --nl-green-light: #40916c;
    --nl-green-dark:  #1b4332;
    --nl-accent:      #52b788;
    --nl-leaf:        #95d5b2;
    --nl-bg-light:    #f4f6f9;
}

/* Sidebar brand link */
.brand-link {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem 0.5rem;
}

.brand-link .brand-text {
    font-size: 1.1rem;
}

/* Sidebar active item */
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active {
    background-color: var(--nl-green);
    color: #fff;
}

.sidebar-dark-primary .nav-sidebar .nav-treeview > .nav-item > .nav-link.active {
    background-color: rgba(45, 106, 79, 0.3);
    color: #fff;
}

/* Sidebar header labels */
.nav-header {
    font-size: 0.7rem;
    letter-spacing: 1px;
    padding: 0.75rem 1rem 0.25rem;
    color: rgba(255, 255, 255, 0.4) !important;
    font-weight: 600;
}


/* =============================================
   2. CONTENT & LAYOUT
   ============================================= */

/* Content header page title */
.content-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #343a40;
}

/* Main content background */
.content-wrapper {
    background-color: var(--nl-bg-light);
}

/* Card styling */
.card {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.25rem;
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.card-outline .card-header {
    background-color: transparent;
}

.card .card-title {
    font-weight: 600;
    font-size: 0.95rem;
}


/* =============================================
   3. SMALL BOX (DASHBOARD STATS)
   ============================================= */

.small-box {
    border-radius: 8px;
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.small-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.small-box .inner h3 {
    font-size: 2rem;
    font-weight: 700;
}

.small-box .inner p {
    font-size: 0.9rem;
}

.small-box .icon {
    top: 10px;
    right: 15px;
    font-size: 60px;
    opacity: 0.2;
    transition: opacity 0.15s;
}

.small-box:hover .icon {
    opacity: 0.35;
}

.small-box-footer {
    border-radius: 0 0 8px 8px;
}


/* =============================================
   4. STATUS BADGES
   ============================================= */

.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.6em;
    letter-spacing: 0.3px;
}

/* Custom status colors */
.badge-status-delivered  { background-color: #28a745; color: #fff; }
.badge-status-pending    { background-color: #ffc107; color: #212529; }
.badge-status-cancelled  { background-color: #dc3545; color: #fff; }
.badge-status-in-transit { background-color: #17a2b8; color: #fff; }
.badge-status-processing { background-color: #007bff; color: #fff; }
.badge-status-failed     { background-color: #dc3545; color: #fff; }
.badge-status-assigned   { background-color: #6f42c1; color: #fff; }
.badge-status-refunded   { background-color: #343a40; color: #fff; }


/* =============================================
   5. TABLES
   ============================================= */

.table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-top: none;
    font-weight: 600;
    white-space: nowrap;
}

.table-sm td,
.table-sm th {
    padding: 0.5rem 0.75rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.04);
}


/* =============================================
   6. FORMS
   ============================================= */

.form-control:focus {
    border-color: var(--nl-accent);
    box-shadow: 0 0 0 0.2rem rgba(82, 183, 136, 0.25);
}

.btn-primary {
    background-color: var(--nl-green);
    border-color: var(--nl-green);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--nl-green-dark);
    border-color: var(--nl-green-dark);
}

.btn-outline-primary {
    color: var(--nl-green);
    border-color: var(--nl-green);
}

.btn-outline-primary:hover {
    background-color: var(--nl-green);
    border-color: var(--nl-green);
    color: #fff;
}


/* =============================================
   7. FLASH MESSAGES
   ============================================= */

.flash-message {
    border-radius: 6px;
    border-left: 4px solid;
    animation: flashSlideIn 0.3s ease-out;
}

.flash-message.alert-success { border-left-color: #28a745; }
.flash-message.alert-danger  { border-left-color: #dc3545; }
.flash-message.alert-warning { border-left-color: #ffc107; }
.flash-message.alert-info    { border-left-color: #17a2b8; }

@keyframes flashSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =============================================
   8. LOGIN PAGE
   ============================================= */

.login-box {
    width: 400px;
    max-width: 95vw;
}

.login-box .card {
    border: none;
}

.login-logo {
    margin-bottom: 20px;
}

/* iCheck-like checkbox for login */
.icheck-primary input[type="checkbox"] {
    margin-right: 6px;
}


/* =============================================
   9. ERROR PAGES
   ============================================= */

.error-page {
    padding: 40px 0;
}

.error-page .headline {
    font-size: 6rem;
    font-weight: 300;
    float: left;
    margin-right: 30px;
}

.error-page .error-content {
    margin-left: 160px;
}

@media (max-width: 576px) {
    .error-page .headline {
        float: none;
        font-size: 4rem;
        text-align: center;
    }
    .error-page .error-content {
        margin-left: 0;
        text-align: center;
    }
}


/* =============================================
   10. RESPONSIVE TWEAKS
   ============================================= */

/* Smaller screens: stack stat boxes */
@media (max-width: 768px) {
    .small-box .inner h3 {
        font-size: 1.5rem;
    }

    .content-header h1 {
        font-size: 1.25rem;
    }

    /* Hide breadcrumb on very small screens */
    .breadcrumb {
        display: none;
    }
}

/* Ensure tables don't overflow cards */
.card-body.table-responsive {
    padding: 0;
}

.card-body.table-responsive .table {
    margin-bottom: 0;
}

/* Navbar items — compact spacing */
.navbar-nav .nav-link {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}
.navbar-nav.ml-auto .nav-link {
    padding-left: 0.3rem;
    padding-right: 0.3rem;
    font-size: 0.9rem;
}
@media (max-width: 575.98px) {
    .navbar-nav.ml-auto .nav-link {
        padding-left: 0.2rem;
        padding-right: 0.2rem;
    }
    .navbar-nav .nav-link {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

/* Footer */
.main-footer {
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #dee2e6;
}


/* =============================================
   11. UTILITY CLASSES
   ============================================= */

.text-rupee::before {
    content: '\20B9';
    font-family: inherit;
}

.cursor-pointer {
    cursor: pointer;
}

.no-wrap {
    white-space: nowrap;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading spinner overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--nl-green);
}

/* Callout (AdminLTE extension) */
.callout {
    border-radius: 6px;
}

/* Quick action buttons on dashboard */
.btn-block.py-3 i.d-block {
    margin-bottom: 0.5rem;
}


/* =============================================
   12. MOBILE FILTERS
   ============================================= */

/* The floating filter button - only visible on mobile */
.mobile-filter-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040;
    border-radius: 50px;
    padding: 10px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: none !important; /* Hidden by default, JS shows it */
}

/* On mobile: hide the desktop filter card */
@media (max-width: 767.98px) {
    .filter-card {
        display: none !important;
    }
    .mobile-filter-btn.has-filters {
        display: inline-block !important;
    }
}

/* Active filter indicator badge on mobile button */
.mobile-filter-btn .filter-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
}

/* Make modal filter form fields stack vertically */
#mobileFilterBody .row {
    flex-direction: column;
}
#mobileFilterBody .row > [class*="col-"] {
    max-width: 100%;
    flex: 0 0 100%;
}
#mobileFilterBody .form-group {
    margin-bottom: 1rem;
}


/* =============================================
   13. TEMPLATE MANAGER
   ============================================= */

/* Preview panel background */
.template-preview-panel {
    background: #f5f5f5;
    border-radius: 4px;
    min-height: 200px;
}

/* Chat bubble (WhatsApp/SMS preview) */
.tpl-chat-bubble {
    background: #dcf8c6;
    padding: 10px 14px;
    border-radius: 8px 8px 0 8px;
    max-width: 300px;
    margin: 10px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Email preview card */
.tpl-email-preview {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    margin: 10px auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Push notification card */
.tpl-push-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    max-width: 350px;
    margin: 10px auto;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Monospace textarea for code editing */
.tpl-monospace-editor {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    tab-size: 2;
    background: #fafafa;
    border: 1px solid #ddd;
}

.tpl-monospace-editor:focus {
    background: #fff;
}

/* Iframe preview wrapper */
.tpl-iframe-wrapper {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
}

.tpl-preview-iframe {
    width: 100%;
    min-height: 400px;
    border: none;
    display: block;
}


/* =============================================
   14. THEME MANAGER
   ============================================= */

/* Color swatches for sidebar skin selection */
.theme-swatch {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 4px;
}

.theme-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.theme-swatch.active {
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.3);
}

.theme-swatch-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: block;
}

.theme-swatch-label {
    cursor: pointer;
    text-align: center;
}

/* Color picker group */
.theme-color-picker-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-color-picker {
    width: 40px;
    height: 34px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
    background: none;
}

.theme-color-picker-group .form-control-sm {
    flex: 1;
    font-family: monospace;
}

/* Miniature preview wrapper */
.theme-mini-preview-wrapper {
    background: #e9ecef;
    border-radius: 6px;
    padding: 8px;
    overflow: hidden;
}

.theme-mini-preview {
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    font-size: 0;
}

/* Mini navbar */
.mini-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    font-size: 10px;
    font-weight: 600;
}

.mini-navbar-brand {
    font-size: 10px;
}

.mini-navbar-items {
    display: flex;
    gap: 4px;
}

.mini-nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.15);
    display: block;
}

/* Mini body layout */
.mini-body-wrap {
    display: flex;
    min-height: 180px;
}

/* Mini sidebar */
.mini-sidebar {
    width: 60px;
    background: #343a40;
    padding: 8px 4px;
    flex-shrink: 0;
    transition: background 0.3s;
}

.mini-sidebar-user {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mini-avatar {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    flex-shrink: 0;
}

.mini-user-text {
    width: 28px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.2);
}

.mini-menu-item {
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.15);
    margin-bottom: 4px;
    transition: background 0.3s;
}

.mini-menu-item.active {
    background: #007bff;
}

.mini-menu-header {
    height: 3px;
    width: 70%;
    border-radius: 2px;
    background: rgba(255,255,255,0.08);
    margin: 6px 0 4px;
}

/* Mini content area */
.mini-content {
    flex: 1;
    background: #f4f6f9;
    padding: 8px;
    transition: background 0.3s;
}

.mini-breadcrumb {
    height: 4px;
    width: 50%;
    background: rgba(0,0,0,0.08);
    border-radius: 2px;
    margin-bottom: 8px;
}

.mini-stats-row {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.mini-stat-box {
    flex: 1;
    height: 20px;
    border-radius: 3px;
    background: #007bff;
    transition: background 0.3s;
}

.mini-card {
    background: #fff;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
    transition: background 0.3s;
}

.mini-card-header {
    height: 6px;
    background: rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.mini-card-body {
    padding: 4px;
}

.mini-table-row {
    height: 4px;
    background: rgba(0,0,0,0.06);
    border-radius: 2px;
    margin-bottom: 3px;
}

.mini-table-row:last-child {
    width: 70%;
}

.mini-btn {
    width: 30px;
    height: 8px;
    border-radius: 3px;
    background: #007bff;
    transition: background 0.3s;
}

/* Preset theme cards */
.preset-card {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.15s;
    background: #fff;
    height: 100%;
}

.preset-card:hover {
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.preset-card.preset-active {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.2);
}

.preset-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    color: #fff;
    font-size: 16px;
}

.preset-card-label {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 2px;
    color: #333;
    line-height: 1.2;
}

.preset-card-desc {
    font-size: 0.68rem;
    color: #888;
    line-height: 1.3;
}


/* =============================================
   15. PARTNER MODULE
   ============================================= */

/* Partner settings inline icons */
.partner-settings-icons {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.partner-settings-icons i {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Partner payment badge */
.partner-payment-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.9rem;
}

/* CRM Lead pipeline card */
.lead-pipeline-card .small-box {
    cursor: pointer;
    margin-bottom: 0.75rem;
}

.lead-pipeline-card .small-box .inner h4 {
    font-size: 1.75rem;
    font-weight: 700;
}

.lead-pipeline-card .small-box .inner p {
    font-size: 0.8rem;
    margin-bottom: 0;
}

/* Lead activity timeline */
.lead-timeline .timeline-item {
    border-left: 2px solid #dee2e6;
    padding-left: 20px;
    position: relative;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.lead-timeline .timeline-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6c757d;
    border: 2px solid #fff;
}

.lead-timeline .timeline-item.action-call::before { background: #28a745; }
.lead-timeline .timeline-item.action-email::before { background: #007bff; }
.lead-timeline .timeline-item.action-visit::before { background: #ffc107; }
.lead-timeline .timeline-item.action-status_change::before { background: #dc3545; }
.lead-timeline .timeline-item.action-followup_set::before { background: #6c757d; }
.lead-timeline .timeline-item.action-note::before { background: #17a2b8; }

.lead-timeline .timeline-meta {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 2px;
}

.lead-timeline .timeline-content {
    font-size: 0.85rem;
}

/* Map container */
.map-container {
    width: 100%;
    height: 70vh;
    min-height: 400px;
    border-radius: 4px;
}

/* Catalog assignment modal */
.catalog-assign-modal .modal-body .form-group {
    margin-bottom: 0.75rem;
}

/* City catalog tabs */
.city-catalog-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 1rem;
}

.city-catalog-tabs .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
}

/* Overdue followup highlight */
.text-overdue {
    color: #dc3545;
    font-weight: 600;
}
