/* ============================================
   NINJAONE DESIGN SYSTEM - GLOBAL STYLES
   ============================================ */

/* === RESET & BASE === */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #111827;
    background: #ffffff;
}

/* === PAGE CONTAINER === */
.page-container {
    padding: 0;
    max-width: 100%;
    margin: 0;
    min-height: 100vh;
    background: #ffffff;
}

/* === BREADCRUMB NAVIGATION === */
.breadcrumb-nav {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.breadcrumb-link {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s ease;
}

.breadcrumb-link:hover {
    color: #111827;
}

.breadcrumb-separator {
    color: #d1d5db;
    font-size: 0.625rem;
}

.breadcrumb-current {
    color: #111827;
    font-weight: 500;
}

/* === PAGE HEADER === */
.page-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1.5rem 1.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title-section h1 {
    font-size: 1.875rem;
    font-weight: 600;
    margin: 0;
    color: #111827;
}

.page-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* === PATH BAR INPUT === */
.path-bar-input {
    flex: 1;
    min-width: 200px;
    padding: 0.375rem 0.75rem;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    outline: none;
    transition: all 200ms;
}

.path-bar-input:focus {
    background: #fff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.path-bar-input::placeholder {
    color: #9ca3af;
    font-family: inherit;
}

/* === ITEM COUNT BADGE === */
.item-count-badge {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    padding: 0.25rem 0.75rem;
    background: #f3f4f6;
    border-radius: 6px;
}

/* === BUTTONS === */
.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon i {
    font-size: 0.875rem;
}

.btn-primary {
    padding: 0.5rem 1rem;
    background: #2563eb;
    border: 1px solid #2563eb;
    border-radius: 0.375rem;
    color: white;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-secondary {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* === CARDS === */
.ninja-card {
    background: white;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.ninja-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}

.ninja-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.ninja-card-body {
    padding: 1.5rem;
}

.ninja-card-compact .ninja-card-body {
    padding: 1rem 1.5rem;
}

/* === GRID LAYOUT === */
.ninja-grid {
    display: grid;
    gap: 1.25rem;
}

.ninja-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.ninja-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.ninja-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1400px) {
    .ninja-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .ninja-grid-2,
    .ninja-grid-3,
    .ninja-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* === INFO GRID === */
.info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    align-items: start;
}

.info-label {
    color: #6b7280;
    font-weight: 400;
}

.info-value {
    color: #111827;
    font-weight: 400;
}

.info-link {
    color: #3b82f6;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease;
}

.info-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* === TABLES === */
.ninja-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.ninja-table thead {
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 5;
}

.ninja-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.clients-table-scroll {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.clients-table-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.clients-table-scroll:hover {
    scrollbar-width: thin;
}

.clients-table-scroll:hover::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.ninja-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.15s ease;
}

.ninja-table tbody tr:hover {
    background: #f9fafb;
    cursor: pointer;
}

.ninja-table tbody td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: #1f2937;
}

/* Automation Select Button - styled button for clickable table cells */
.automation-select-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    display: block;
    width: 100%;
    text-align: left;
}

.automation-select-btn:hover {
    text-decoration: none;
}

.automation-select-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

.automation-row:hover {
    background: #f3f4f6;
}

.automation-row.selected {
    background: #eff6ff;
}

/* === MODAL Z-INDEX FIX === */
/* Ensure Bootstrap modal is above backdrop and clickable */
#automationLibraryModal {
    z-index: 1055 !important;
}

#automationLibraryModal .modal-dialog {
    z-index: 1056 !important;
}

#automationLibraryModal .modal-content {
    z-index: 1057 !important;
    pointer-events: auto !important;
}

/* === MODAL STYLES (Global) === */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1050;
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow: auto;
}

.settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.settings-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #111827;
}

.settings-modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
}

.settings-modal-close:hover {
    color: #374151;
}

.settings-modal-body {
    padding: 1.5rem;
}

.settings-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

.modal-confirm-content {
    text-align: center;
    margin-bottom: 1rem;
}

.modal-confirm-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.modal-confirm-icon.danger {
    background: #fee2e2;
    color: #dc2626;
}

.modal-confirm-description {
    font-size: 0.95rem;
    color: #374151;
}

.delete-items-list {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem;
    margin-top: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

.delete-item-row {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.5rem;
    font-size: 0.85rem;
    color: #374151;
    border-radius: 0.25rem;
}

.delete-item-row:not(:last-child) {
    border-bottom: 1px solid #e5e7eb;
}

.modal-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-btn-secondary {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
}

.modal-btn-secondary:hover {
    background: #f3f4f6;
}

.modal-btn-primary {
    background: #3b82f6;
    border: none;
    color: #fff;
}

.modal-btn-primary:hover {
    background: #2563eb;
}

.modal-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-btn-danger {
    background: #dc2626;
    border: none;
    color: #fff;
}

.modal-btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.modal-btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === STATUS INDICATORS === */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.status-online,
.status-dot.status-healthy {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.status-dot.status-warning {
    background: #f59e0b;
}

.status-dot.status-error,
.status-dot.status-offline {
    background: #ef4444;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.status-badge.status-online {
    background: #dcfce7;
    color: #166534;
}

.status-badge.status-warning {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.status-error {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.status-offline {
    background: #f3f4f6;
    color: #6b7280;
}

/* === FILTERS BAR === */
.filters-bar {
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* === STATS BOX === */
.stats-box {
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    text-align: center;
}

.stats-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.stats-value {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
}

.stats-value.stats-success {
    color: #10b981;
}

.stats-value.stats-warning {
    color: #f59e0b;
}

.stats-value.stats-danger {
    color: #ef4444;
}

/* === LOADING SPINNER === */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.loading-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
    color: #3b82f6;
}

/* === ALERTS === */
.alert-ninja {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid;
    margin-bottom: 1rem;
}

.alert-ninja.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-ninja.alert-warning {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.alert-ninja.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert-ninja.alert-success {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #166534;
}

/* === HEALTH CATEGORY === */
.health-category {
    margin-bottom: 1.5rem;
}

.health-category:last-child {
    margin-bottom: 0;
}

.health-category-title {
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid currentColor;
}

.health-issues {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.health-issue-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    transition: all 0.2s;
}

.health-issue-item:hover {
    background: rgba(0, 0, 0, 0.04);
    transform: translateX(2px);
}

.health-issue-item i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.health-issue-item span:first-of-type {
    flex: 1;
}

.health-issue-item span:last-of-type {
    font-weight: 700;
}

/* === HEALTH BAR === */
.health-bar {
    display: flex;
    height: 24px;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #e5e7eb;
}

.health-bar-segment {
    transition: width 0.5s ease;
}

.health-bar-segment.bg-success {
    background: #10b981;
}

.health-bar-segment.bg-warning {
    background: #f59e0b;
}

.health-bar-segment.bg-danger {
    background: #ef4444;
}

.health-bar-segment.bg-secondary {
    background: #9ca3af;
}

/* === SCROLLBAR === */
.ninja-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.ninja-scrollbar::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.ninja-scrollbar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.ninja-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* === UTILITIES === */
.text-muted {
    color: #6b7280 !important;
}

.text-success {
    color: #10b981 !important;
}

.text-warning {
    color: #f59e0b !important;
}

.text-danger {
    color: #ef4444 !important;
}

.bg-success {
    background-color: #10b981 !important;
}

.bg-warning {
    background-color: #f59e0b !important;
}

.bg-danger {
    background-color: #ef4444 !important;
}

.bg-secondary {
    background-color: #9ca3af !important;
}

/* === MINIMAL PAGE HEADER === */
.page-header-minimal {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
}

.page-header-minimal .page-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    border: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.page-header-minimal .page-icon i {
    font-size: 1.25rem;
    color: #374151;
}

.page-header-minimal h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4b5563;
    margin: 0;
}

/* === ACTION BAR === */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}

.action-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.action-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .page-header {
        padding: 1rem;
    }

    .page-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .filters-bar {
        padding: 0.75rem;
    }
    
    .page-header-minimal {
        padding: 1rem;
    }
    
    .page-header-minimal .page-icon {
        width: 40px;
        height: 40px;
    }
    
    .page-header-minimal h1 {
        font-size: 1.25rem;
    }
    
    .action-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }
}
