/* Main Application Styles */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --border-radius: 12px;
    --placeholder-opacity: 0.6;  /* Global placeholder text opacity - change this value to adjust all placeholders */
}

/* Global placeholder styling - uses CSS variable for easy customization */
::placeholder {
    /*opacity: var(--placeholder-opacity);*/
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
    /*color: #6c757d;*/
}

.form-control::placeholder {
    /*opacity: var(--placeholder-opacity);*/
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
    /*color: #6c757d;*/
}


::-webkit-input-placeholder { /* WebKit browsers */
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
}

::-moz-placeholder { /* Mozilla Firefox */
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
}

:-ms-input-placeholder { /* Internet Explorer 10-11 */
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
}

:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
}

/* Form text helper styling to match placeholder opacity */
.form-text {
    opacity: calc(var(--placeholder-opacity) + 0.2);  /* Slightly more visible than placeholders */
    color: #6c757d;
}

body {
    padding-top: 56px; /* Height of Bootstrap navbar */
    background-color: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Responsive padding for main container */
#mainContainer {
    padding-top: 0;
}

/* Page header - tight spacing */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.75rem 0;
    padding: 0 1rem;
}

.page-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

/* Mobile specific adjustments */
@media (max-width: 576px) {
    body {
        padding-top: 56px; /* Minimal padding on mobile */
    }
    
    #mainContent {
        padding: 0.25rem; /* Very reduced padding on mobile */
    }
    
    .page-header {
        margin: 0.25rem 0; /* Minimal margin on mobile */
        padding: 0 0.5rem;
    }
    
    .page-header h2 {
        font-size: 1.25rem; /* Smaller heading on mobile */
    }
    
    .card {
        margin-bottom: 0.5rem;
    }
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.navbar-brand {
    font-weight: bold;
    color: var(--primary-color) !important;
}

.nav-link {
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.nav-link.active {
    color: var(--primary-color) !important;
    border-bottom: 2px solid var(--primary-color);
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-weight: bold;
    border-radius: 10px 10px 0 0 !important;
}

/* Dashboard Stats */
.stat-card {
    text-align: center;
    padding: 20px;
}

.stat-card i {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.stat-card h3 {
    font-size: 32px;
    font-weight: bold;
    margin: 10px 0;
}

.stat-card p {
    color: #6c757d;
    margin: 0;
}

/* Tables */
.table-responsive {
    border-radius: 10px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--dark-color);
    color: white;
    border: none;
    font-weight: 500;
}

.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    border-radius: 5px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.875rem;
}

.btn-group-sm > .btn {
    padding: 5px 10px;
}

/* Forms */
.form-control, .form-select {
    border-radius: 5px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
}

/* Modals */
.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Code/Pre blocks */
pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.code-output {
    max-height: 500px;
    overflow-y: auto;
}

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

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Badges */
.badge {
    padding: 5px 10px;
    font-weight: 500;
    border-radius: 5px;
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-online {
    background-color: var(--success-color);
    animation: pulse 2s infinite;
}

.status-offline {
    background-color: var(--danger-color);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Command/Script Editor */
.code-editor {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    min-height: 200px;
}

/* Log Viewer */
.log-entry {
    padding: 10px;
    border-left: 3px solid transparent;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.log-entry:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.log-entry.success {
    border-left-color: var(--success-color);
}

.log-entry.error {
    border-left-color: var(--danger-color);
}

.log-entry.warning {
    border-left-color: var(--warning-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }
    
    .card {
        margin-bottom: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card i {
        font-size: 36px;
    }
    
    .stat-card h3 {
        font-size: 24px;
    }
    
    .table {
        font-size: 14px;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 5px !important;
        margin-bottom: 5px;
    }
    
    /* Make tables horizontally scrollable on mobile */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Stack form groups on mobile */
    .row.g-3 > [class*="col-"] {
        margin-bottom: 10px;
    }
}

/* Tablet Responsive */
@media (min-width: 768px) and (max-width: 1024px) {
    .container-fluid {
        padding: 0 20px;
    }
}

/* Action Buttons Container */
.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* Quick Actions */
.quick-action {
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-action:hover {
    transform: scale(1.05);
}

/* Toast Notifications Override */
.notyf__toast {
    border-radius: 10px !important;
    font-family: inherit !important;
}

.notyf__toast--success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

.notyf__toast--error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
}

/* Clear Filters button on gradient card headers */
.card-header .btn-outline-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.card-header .btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.7);
    color: white;
}

/* Logs count text on gradient card headers */
.card-header .text-muted,
.card-header small.text-muted {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: white !important;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h4 {
    margin-bottom: 10px;
}

.empty-state p {
    margin-bottom: 20px;
}

/* Animated Background for Dashboard */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Host Cards Styling */
.hosts-container {
    max-width: 100%;
    margin: 0 auto;
}

.hosts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.host-card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
    overflow: hidden;
}

.host-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.host-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.host-info {
    flex: 1;
}

.host-id {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

.host-address {
    font-size: 1rem;
    color: #333;
    font-weight: 400;
    margin-top: 4px;
}

.host-details {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.host-type {
    font-size: 0.75rem;
    padding: 4px 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.host-port {
    font-size: 0.875rem;
    color: #6c757d;
}

.host-counts {
    display: flex;
    gap: 24px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    font-size: 0.875rem;
    color: #6c757d;
}

.count-item strong {
    color: #333;
    font-weight: 600;
}

.host-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.btn-icon i {
    font-size: 14px;
}

/* Disabled delete button styling */
.btn-icon[disabled] {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.btn-icon.btn-secondary[disabled] {
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-icon.btn-secondary[disabled]:hover {
    background-color: #6c757d;
    border-color: #6c757d;
}

/* Responsive adjustments for host cards */
@media (min-width: 768px) {
    .hosts-container {
        max-width: 600px;
    }
}

@media (max-width: 576px) {
    .host-card-body {
        padding: 12px;
    }
    
    .host-actions {
        margin-top: 8px;
        padding-top: 8px;
    }
}

/* Command Cards - Similar to Host Cards */
.commands-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.command-card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
    overflow: hidden;
}

.command-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.command-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.command-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.command-id {
    font-size: 1rem;
}

.command-id .text-muted,
.command-host .text-muted,
.command-description .text-muted {
    font-size: 0.85rem;
    font-weight: normal;
}

.command-description {
    color: #333;
    font-size: 0.95rem;
}

.command-description em {
    color: #999;
    font-style: italic;
}

.command-code {
    background: #f5f5f5;
    padding: 5px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    overflow-x: auto;
    white-space: pre;
    text-align: left !important;
    color: #cc5916 ;

}

/*.command-code code {
    text-align: left;
    display: block;
}*/

.command-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.command-schedule {
    font-size: 0.9rem;
    color: #666;
}

.command-features {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.command-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #666;
}

.command-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.command-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Purple badge for chaining */
.bg-purple {
    background-color: #8b5cf6 !important;
}

/* Mobile responsiveness for command cards */
@media (min-width: 768px) {
    .commands-container {
        max-width: 600px;
    }
}

@media (max-width: 768px) {
    .command-card-body {
        padding: 12px;
        gap: 10px;
    }
    
    .command-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .command-code {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    
    .command-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .command-actions {
        justify-content: center;
        width: 100%;
        padding-top: 8px;
        border-top: 1px solid #e0e0e0;
    }
    
    .command-stats {
        width: 100%;
        justify-content: space-around;
    }
}

@media (max-width: 576px) {
    .commands-container {
        padding: 0;
    }
    
    .command-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .command-card-body {
        padding: 10px;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
    }
}

/* Reports Styles - Matching Command Cards */
.reports-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.reports-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
    overflow: hidden;
}

.report-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.report-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.report-id {
    font-size: 0.95rem;
}

.report-format {
    display: flex;
    align-items: center;
}

.report-description {
    color: #666;
    font-size: 0.9rem;
}

.report-commands {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
}

.report-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.85rem;
    color: #666;
}

.report-schedule {
    display: flex;
    align-items: center;
}

.report-features {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.report-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

@media (min-width: 992px) {
    .reports-container {
        max-width: 600px;
    }
}

@media (max-width: 768px) {
    .report-card-body {
        padding: 12px;
        gap: 10px;
    }
    
    .report-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .report-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .report-actions {
        justify-content: center;
        width: 100%;
        padding-top: 8px;
        border-top: 1px solid #e0e0e0;
    }
}

@media (max-width: 576px) {
    .reports-container {
        padding: 0;
    }
    
    .report-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .report-card-body {
        padding: 10px;
    }
}

/* PEM Files Styles - Matching Host Cards */
.pem-files-container {
    max-width: 100%;
    margin: 0 auto;
}

.pem-files-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pem-file-card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
    overflow: hidden;
}

.pem-file-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.pem-file-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pem-file-info {
    flex: 1;
}

.pem-file-id {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

.pem-file-details {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 4px;
}

.pem-file-counts {
    display: flex;
    gap: 24px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    font-size: 0.875rem;
    color: #6c757d;
}

.pem-file-counts .count-item strong {
    color: #333;
    font-weight: 600;
}

.pem-file-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

/* Disabled button state for in-use PEM files */
.pem-file-actions .btn.disabled {
    cursor: not-allowed !important;
    pointer-events: auto !important; /* Allow click for alert */
}

.pem-file-actions .btn.opacity-50 {
    opacity: 0.5;
}

/* Responsive adjustments for PEM file cards */
@media (min-width: 768px) {
    .pem-files-container {
        max-width: 600px;
    }
}

@media (max-width: 576px) {
    .pem-file-card-body {
        padding: 12px;
    }
    
    .pem-file-actions {
        margin-top: 8px;
        padding-top: 8px;
    }
}