/* Modern, clean styling for the status dashboard */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

:root {
    /* Typography Variables */
    --dashboard-font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --dashboard-title-size: 32px;
    --service-title-size: 18px;
    --service-status-size: 14px;
    --component-text-size: 13px;
}

body {
    font-family: var(--dashboard-font-family);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #333;
    margin: 0;
    padding: 0;
}

/* Ensure all elements inherit Poppins font */
*, *::before, *::after {
    font-family: inherit;
}

/* Explicitly set Poppins for form elements and buttons */
input, button, select, textarea {
    font-family: 'Poppins', sans-serif;
}

/* Ensure headings use Poppins */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
}

.container {
    max-width: none;
    margin: 0;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: white;
    padding: 15px 0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.header-text {
    flex: 1;
    min-width: 0;
}

.logo {
    max-width: 200px;
    max-height: 50px;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

.header-text h1 {
    font-family: var(--dashboard-font-family);
    font-size: var(--dashboard-title-size);
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    color: #ffffff;
    white-space: nowrap;
}

.header-text p {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.9;
    color: #e8e8e8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.controls-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.controls-group .btn {
    width: 44px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    color: white;
    border: 2px solid #2c5aa0;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    border-color: #4a7bc8;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border: 2px solid #6c757d;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #495057 0%, #6c757d 100%);
    border-color: #868e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: 2px solid #dc3545;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    border-color: #bd2130;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.loading {
    text-align: center;
    padding: 40px;
    color: white;
    font-size: 1.2rem;
}

.error-message {
    background: #dc3545;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* Original dashboard for legacy compatibility */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 0;
    width: 100%;
    align-items: start; /* Align cards to start of their grid area - independent heights */
}

/* New column-based dashboard layout */
.dashboard-columns {
    display: grid;
    column-gap: 8px; /* Reduced horizontal gap for viewing mode */
    row-gap: 8px; /* Proportionate vertical spacing for viewing mode */
    margin-bottom: 0;
    width: 100%;
    align-items: start;
}

.dashboard-column {
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 5px; /* Minimal padding for viewing mode */
    min-height: 400px;
    height: 100%;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Show drag/drop styling only in toggle mode */
.toggle-mode .dashboard-columns {
    column-gap: 20px; /* Restore larger horizontal gap for drag/drop mode */
    row-gap: 20px; /* Keep vertical spacing consistent */
}

.toggle-mode .dashboard-column {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    padding: 15px; /* Restore full padding for drag/drop mode */
}

.dashboard-column.drag-over {
    border-color: #4a7bc8;
    background: rgba(74, 123, 200, 0.1);
    transform: scale(1.02);
}

.dashboard-column .drop-zone {
    display: none;
}

/* Show drop zones only in toggle mode */
.toggle-mode .dashboard-column .drop-zone {
    display: block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.toggle-mode .dashboard-column:hover .drop-zone {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.dashboard-column .service-card {
    margin-bottom: 20px; /* Comfortable spacing between cards in viewing mode */
    position: relative;
}

.dashboard-column .service-card:last-child {
    margin-bottom: 0;
}

/* Same spacing between cards in toggle mode */
.toggle-mode .dashboard-column .service-card {
    margin-bottom: 20px;
}

/* Footer Styles */
.site-footer {
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.site-footer p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Enhanced responsive design for flexbox layout */
@media (min-width: 1200px) {
    .service-card {
        min-width: 200px;
    }
}

@media (min-width: 1600px) {
    .service-card {
        min-width: 180px;
    }
}

@media (min-width: 2000px) {
    .service-card {
        min-width: 160px;
    }
}

@media (min-width: 2560px) {
    .service-card {
        min-width: 150px;
    }
}



.service-card {
    /* Use CSS custom property for background to allow easy overrides */
    background-color: var(--service-card-bg, white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(44, 90, 160, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent content from overflowing the card */
    cursor: default; /* Default cursor */
    -webkit-user-select: text; /* Allow text selection */
    user-select: text; /* Allow text selection */
    position: relative; /* Allow absolute positioning of delete button */
    height: auto; /* Allow natural height - no JavaScript override */
}

.service-card:hover {
    box-shadow: 0 6px 25px rgba(44, 90, 160, 0.15);
    transform: translateY(-2px);
}

.service-card.dragging {
    opacity: 0.7;
    transform: rotate(2deg) scale(1.02);
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(44, 90, 160, 0.2);
}

.service-card.drag-over {
    border: 2px solid #4a7bc8;
    background: rgba(74, 123, 200, 0.02);
    transform: translateY(-1px);
}

/* Enable drag styling only in toggle mode */
.toggle-mode .service-card {
    cursor: move !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(44, 90, 160, 0.2);
    border-color: rgba(44, 90, 160, 0.2);
}

.service-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.drag-handle {
    color: #999;
    cursor: grab;
    padding: 5px;
    margin-right: 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
}

.drag-handle:hover {
    color: #666;
    background: rgba(0,0,0,0.05);
}

.drag-handle:active {
    cursor: grabbing;
}



.service-name {
    font-family: var(--dashboard-font-family);
    font-size: var(--service-title-size);
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
    flex: 1;
}

.overall-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--dashboard-font-family);
    font-size: var(--service-status-size);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 15px;
    width: fit-content;
}

.status-operational {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-degraded {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-partial {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-major {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1aeb5;
}

.status-unknown {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

.components {
    margin-bottom: 20px;
    flex: 1; /* Take up remaining space in the service card */
    overflow-y: auto; /* Allow scrolling if content is too tall */
    max-height: 100%; /* Don't exceed parent container */
}

/* In toggle mode, expand service cards to show all content without scrolling */
.toggle-mode .service-card {
    height: auto !important; /* Override any height restrictions */
}

.toggle-mode .service-card .components {
    overflow-y: visible !important; /* Remove scrolling in edit mode */
    max-height: none !important; /* Remove height restrictions in edit mode */
}

.toggle-mode .service-card {
    overflow: visible !important; /* Allow content to expand beyond card bounds if needed */
}

.component {
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.component:last-child {
    margin-bottom: 0;
}

/* Component backgrounds based on status */
.component.status-operational {
    background: #d4edda;
    border-color: #c3e6cb;
}

.component.status-degraded {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.component.status-partial {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.component.status-major {
    background: #f8d7da;
    border-color: #f1aeb5;
}

.component.status-unknown {
    background: #e2e3e5;
    border-color: #d6d8db;
}

.component-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
}

.component-name {
    font-weight: 600;
    color: #495057;
    flex: 1;
    font-family: var(--dashboard-font-family);
    font-size: var(--component-text-size);
}

.component-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--dashboard-font-family);
    font-size: var(--component-text-size);
    font-weight: 600;
    color: #495057;
}

.component-uptime {
    padding: 8px 15px 12px 15px;
    font-family: var(--dashboard-font-family);
    font-size: calc(var(--component-text-size) - 2px);
    color: #6c757d;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.uptime-percentage {
    background: #e3f2fd;
    color: #1565c0;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 500;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.operational {
    background: #28a745;
}

.status-indicator.degraded_performance {
    background: #ffc107;
}

.status-indicator.partial_outage {
    background: #fd7e14;
}

.status-indicator.major_outage {
    background: #dc3545;
}

.status-indicator.under_maintenance {
    background: #6f42c1;
}

/* Hierarchical component styles */
.component-group {
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.component-group-header {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

/* Group header backgrounds based on status */
.component-group-header.status-operational {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.component-group-header.status-degraded {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.component-group-header.status-partial {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.component-group-header.status-major {
    background: linear-gradient(135deg, #f8d7da 0%, #f1aeb5 100%);
}

.component-group-header.status-unknown {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
}

.component-group-header:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.group-toggle {
    transition: transform 0.2s ease;
    color: #495057;
    font-size: 12px;
}

.component-group.expanded .group-toggle {
    transform: rotate(90deg);
}

.component-group-header .component-name {
    flex: 1;
    font-weight: 600;
    color: #495057;
    font-family: var(--dashboard-font-family);
    font-size: var(--component-text-size);
}

.component-group-header .component-status {
    font-family: var(--dashboard-font-family);
    font-size: var(--component-text-size);
    font-weight: 600;
    color: #495057;
}

.component-children {
    display: none;
    padding: 15px 15px 10px 15px;
    background: white;
}

.component-group.expanded .component-children {
    display: block;
}

.component-children .component {
    margin-left: 20px;
    margin-bottom: 15px;
}

.component-children .component:last-child {
    margin-bottom: 0;
}

.incidents {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 0 6px 6px 0;
}

.incidents h4 {
    color: #856404;
    margin-bottom: 10px;
    font-size: 14px;
}

.incident {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.7);
}

.incident:last-child {
    margin-bottom: 0;
}

.incident.major_outage {
    border-left: 4px solid #dc3545;
}

.incident.partial_outage {
    border-left: 4px solid #fd7e14;
}

.incident.degraded_performance {
    border-left: 4px solid #ffc107;
}

.incident-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.incident-status {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
}

.incident-updates {
    font-size: 13px;
    color: #495057;
}

.incident-update {
    margin-bottom: 8px;
    padding-left: 10px;
    border-left: 2px solid #dee2e6;
}

.incident-update:last-child {
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .controls-group {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
    }
    
    .service-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        min-height: auto;
    }
    
    .service-name {
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
        white-space: normal;
    }
    
    .service-card {
        padding: 15px;
    }
    
    .component-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 96vw;
    width: 96vw;
    min-width: 600px;
    height: auto;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

.modal-header h3 {
    margin: 0;
    color: #1a1a2e;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 16px;
    right: 20px;
}

.close-btn:hover {
    color: #dc3545;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #1a1a2e;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4a7bc8;
    box-shadow: 0 0 0 3px rgba(74, 123, 200, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 12px;
}

/* Font Size Control Styles */
.font-size-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.font-size-control input[type="range"] {
    flex: 1;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.font-size-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #4a7bc8;
    border-radius: 50%;
    cursor: pointer;
}

.font-size-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #4a7bc8;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#font-size-display,
#dashboard-title-display,
#service-title-display,
#service-status-display,
#component-text-display {
    min-width: 45px;
    text-align: center;
    font-weight: 600;
    color: #1a1a2e;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* Typography Controls Layout */
.typography-controls {
    display: grid;
    gap: 16px;
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.typography-controls .form-group {
    margin-bottom: 0;
}

.typography-controls label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

/* Color Input Group Styles */
.color-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 5px;
    background: white;
    transition: border-color 0.2s ease;
}

.color-input-group:focus-within {
    border-color: #4a7bc8;
    box-shadow: 0 0 0 3px rgba(74, 123, 200, 0.1);
}

.color-picker {
    flex: 0 0 60%;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
    outline: none;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 4px;
}

.color-picker::-webkit-color-swatch {
    border: 2px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.color-text {
    flex: 0 0 40%;
    padding: 8px 10px;
    border: none;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: white;
    color: #333;
    outline: none;
    text-transform: uppercase;
    font-weight: 500;
}

.color-text::placeholder {
    color: #999;
    text-transform: uppercase;
}

/* Preview Section Styles */
.logo-preview {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.logo-preview h5 {
    margin-bottom: 15px;
    color: #1a1a2e;
    font-weight: 600;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e9ecef;
}

.confirm-delete-content {
    text-align: center;
    padding: 20px 0;
}

.confirm-delete-icon {
    font-size: 48px;
    color: #ffc107;
    margin-bottom: 20px;
}

.confirm-delete-content p {
    margin: 10px 0;
    color: #1a1a2e;
}

.confirm-delete-note {
    font-size: 14px;
    color: #6c757d !important;
    font-style: italic;
}

/* Toggle Mode Styles */
#toggle-visibility-mode {
    min-height: 36px; /* Match height of other buttons */
    min-width: 36px;  /* Square appearance for icon-only button */
    justify-content: center; /* Center the icon */
    padding: 8px; /* Reduce padding since there's no text */
}

.toggle-mode-active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-color: #28a745;
}

.toggle-mode-active:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea97c 100%);
    border-color: #1e7e34;
}

.component.toggle-mode {
    position: relative;
    border: 1px dashed transparent;
    transition: all 0.2s ease;
}

.component.toggle-mode:hover {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.02);
}

.component.toggle-mode.hidden {
    opacity: 0.5;
    filter: grayscale(50%);
}

.component.toggle-mode.visible {
    border-color: rgba(40, 167, 69, 0.3);
}

.visibility-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.visibility-toggle:hover {
    border-color: #adb5bd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.visibility-toggle.visible {
    color: #28a745;
    border-color: #28a745;
}

.visibility-toggle.hidden {
    color: #6c757d;
    border-color: #6c757d;
}

/* Service cards in toggle mode */
.service-card.toggle-mode {
    border: 1px dashed rgba(0, 123, 255, 0.2);
    background: rgba(255, 255, 255, 0.98);
}

.service-card.toggle-mode:hover {
    border-color: #007bff;
    background: rgba(255, 255, 255, 1);
}

/* Component groups in toggle mode */
.component-group.toggle-mode {
    position: relative;
    border: 1px dashed transparent;
    transition: all 0.2s ease;
}

.component-group.toggle-mode:hover {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.02);
}

.component-group.toggle-mode.hidden {
    opacity: 0.5;
    filter: grayscale(50%);
}

.component-group.toggle-mode.visible {
    border-color: rgba(40, 167, 69, 0.3);
}

/* Position visibility toggle for accordion headers */
.component-group-header {
    position: relative;
}

.component-group-header .visibility-toggle {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}

/* Settings Modal Styles */
.settings-modal-content {
    max-width: 900px;
    width: 95vw;
}

.settings-tabs {
    display: flex;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    color: #6c757d;
}

.tab-btn:hover {
    background: rgba(0, 123, 255, 0.05);
    color: #007bff;
}

.tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: rgba(0, 123, 255, 0.05);
}

.tab-btn i {
    margin-right: 8px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.settings-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h4 {
    margin: 0 0 15px 0;
    color: #1a1a2e;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

/* Add New Service 2-Column Layout */
.add-service-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.add-service-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.add-service-column {
    display: flex;
    flex-direction: column;
}

.add-service-button {
    display: flex;
    justify-content: flex-start;
    margin-top: 5px;
}

/* Responsive behavior for smaller screens */
@media (max-width: 768px) {
    .add-service-columns {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.services-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
}

.service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
}

.service-item:last-child {
    border-bottom: none;
}

.service-item-info {
    flex: 1;
}

.service-item-name {
    font-weight: 500;
    color: #1a1a2e;
    margin-bottom: 2px;
}

.service-item-url {
    font-size: 12px;
    color: #6c757d;
}

.remove-service-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease;
}

.remove-service-btn:hover {
    background: #c82333;
}

.visibility-info {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

/* Inline confirmation styles */
.service-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-confirmation {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.confirm-delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.2s ease;
    font-weight: 500;
}

.confirm-delete-btn:hover {
    background: #c82333;
}

.cancel-delete-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.2s ease;
    font-weight: 500;
}

.cancel-delete-btn:hover {
    background: #5a6268;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 10px 15px;
    margin-bottom: 15px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Service Color Controls */
.service-item-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.service-color-control {
    display: flex;
    align-items: center;
}

.service-color-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.service-color-picker {
    width: 36px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
    outline: none;
}

.service-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
}

.service-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.reset-service-color-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-width: 32px;
}

.reset-service-color-btn:hover {
    background: #5a6268;
}

.service-item-actions {
    margin-left: auto;
}

/* Large modal for suggested services */
.large-modal-content {
    max-width: 96vw;
    width: 96vw;
    min-width: 600px;
    height: auto;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Onboarding Modal: Wider and Grid Layout */
/* First-time setup modal: improved mobile & sticky footer */
#suggested-services-modal .modal-content.large-modal-content {
    max-height: 96vh;
    height: 96vh;
    display: flex;
    flex-direction: column;
}

#suggested-services-modal .modal-header {
    flex: 0 0 auto;
}

#suggested-services-modal .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: calc(96vh - 160px); /* Adjust based on header/footer height */
    padding-bottom: 16px;
}

#suggested-services-modal .modal-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 2;
    padding: 24px 24px 16px 24px;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.04);
    flex-shrink: 0;
}

/* Mobile improvements */
@media (max-width: 600px) {
    #suggested-services-modal .modal-content.large-modal-content {
        max-width: 100vw;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    #suggested-services-modal .modal-body {
        max-height: calc(100vh - 160px);
        padding: 8px;
    }
    #suggested-services-modal .modal-footer {
        padding: 16px 8px 12px 8px;
    }
}

#suggested-services-categories {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 32px;
    overflow-y: auto;
}

.suggested-category {
    width: 100%;
}

.suggested-category h3 {
    margin-bottom: 16px;
    font-size: 1.2rem;
    color: #333;
}

.suggested-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 200px);
    gap: 20px;
    width: 100%;
    grid-auto-flow: row;
}

.suggested-service {
    width: 200px;
    max-width: 200px;
    min-width: 200px;
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 18px 12px 12px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 180px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
}

.suggested-service.selected {
    border-color: #0078d4;
    box-shadow: 0 4px 24px rgba(0,120,212,0.18);
    background: linear-gradient(135deg, #e3f0ff 0%, #f6fbff 100%);
    outline: 3px solid #0078d4;
    outline-offset: -2px;
    position: relative;
}

.suggested-service.selected::after {
    content: none;
}

.suggested-service .service-logo,
.service-fallback-icon {
    width: 72px;
    height: 72px;
    margin-bottom: 16px;
    font-size: 40px;
}

.suggested-service .service-info {
    text-align: center;
}

.suggested-service .service-name {
    font-weight: 600;
    font-size: 1rem;
    color: #222;
}

.suggested-service .service-desc {
    font-size: 0.92rem;
    color: #666;
    margin-top: 4px;
}

.suggested-service-checkbox {
    display: none;
}

.service-fallback-icon {
    width: 72px;
    height: 72px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    font-size: 40px;
    color: #888;
    margin-bottom: 16px;
}

#advanced-tab .settings-section {
    margin-top: 32px;
}

#advanced-tab .settings-section:first-child {
    margin-top: 0;
}

#advanced-tab .settings-section h4 {
    margin-bottom: 12px;
}

#advanced-tab .settings-section .form-actions {
    margin-top: 16px;
    gap: 12px;
    display: flex;
    flex-wrap: wrap;
}

#reset-dashboard-btn {
    margin-top: 24px;
}

/* Onboarding modal header help text */
.suggested-modal-help {
    margin-top: 8px;
    color: #6c757d;
    font-size: 1rem;
    font-weight: 400;
    display: block;
    width: 100%;
    text-align: left;
    padding-right: 0;
}

/* Ensure modal-header stacks children vertically */
.modal-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Customization tab 2-column layout */
.customization-columns {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.customization-left-column,
.customization-right-column {
    flex: 1;
    min-width: 0; /* Prevent flex items from overflowing */
}

/* Better spacing between description text and form controls */
.settings-section p {
    margin-bottom: 20px;
}

.settings-section h4 {
    margin-bottom: 10px;
}

.settings-section .form-group {
    margin-top: 0;
}

/* Input with clear button styling */
.input-with-clear {
    position: relative;
    display: inline-block;
    width: 100%;
}

.input-with-clear .form-control {
    padding-right: 40px; /* Make room for the clear button */
}

.clear-input-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: none; /* Hidden by default */
    transition: all 0.2s ease;
    z-index: 10;
}

.clear-input-btn:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.clear-input-btn.show {
    display: block;
}

/* Ensure the clear button doesn't interfere with input focus */
.input-with-clear .form-control:focus {
    z-index: 1;
}

/* Responsive behavior for smaller screens */
@media (max-width: 900px) {
    .customization-columns {
        flex-direction: column;
        gap: 0;
    }
    
    .customization-left-column,
    .customization-right-column {
        flex: none;
        width: 100%;
    }
}




