.sites-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.sites-header {
    margin-bottom: 3rem;
}

.sites-container .header-content {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 2rem;
}

.sites-container .header-content > div {
    text-align: left;
    flex: 1;
    min-width: 0;
}

.sites-header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.sites-header p {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin: 0;
}

.add-studio-btn {
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
    margin-left: auto;
    width: auto;
}

.search-bar {
    margin-bottom: 1.5rem;
}

.sites-container .search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.sites-container .search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.sites-container .loading-message {
    text-align: center;
    padding: 3rem;
}

.sites-container .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.sites-container .loading-message p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.sites-container .empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.sites-container .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.sites-container .empty-state h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.sites-container .empty-state p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.site-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e1e8ed;
}

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

.site-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ecf0f1;
}

.site-header-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.provider-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.provider-badge-mbo {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.provider-badge-wl {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.site-name {
    font-size: 1.4rem;
    color: #2c3e50;
    margin: 0;
    font-weight: 600;
}

.site-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

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

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

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

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

.site-details {
    margin-bottom: 1.5rem;
}

.detail-item {
    display: flex;
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

.detail-label {
    font-weight: 600;
    color: #34495e;
    min-width: 80px;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.detail-value {
    color: #2c3e50;
    flex: 1;
    font-size: 0.9rem;
}

.site-actions {
    text-align: center;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.site-card-buttons {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

.site-card-buttons .btn {
    flex: 1;
    justify-content: center;
}

.sites-container .btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 0.5rem;
}

.sites-container .btn-primary {
    background-color: #3498db;
    color: white;
}

.sites-container .btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.sites-container .btn-secondary {
    background-color: #6c757d;
    color: white;
}

.sites-container .btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.sites-container .btn-success {
    background-color: #28a745;
    color: white;
}

.sites-container .btn-success:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

.sites-container .btn-icon {
    font-size: 1rem;
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 50px;
    height: 24px;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #28a745;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-slider:hover {
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sites-container {
        padding: 1rem;
    }
    
    .sites-header h1 {
        font-size: 2rem;
    }
    
    .sites-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .site-card {
        padding: 1rem;
    }
    
    .site-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .site-status {
        align-self: flex-start;
    }
    
    .sites-container .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .add-studio-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Add Studio Modal Styles — scoped under .add-studio-modal */
.add-studio-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.add-studio-modal.visible {
    opacity: 1;
    visibility: visible;
}

.add-studio-modal .modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
}

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

.add-studio-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.add-studio-modal .modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #2c3e50;
    font-weight: 600;
}

.add-studio-modal .modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.add-studio-modal .modal-close:hover {
    color: #2c3e50;
}

.add-studio-modal .modal-body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
}

.add-studio-modal .modal-body > * {
    width: 100%;
    box-sizing: border-box;
}

.add-studio-modal .form-group {
    margin-bottom: 1.25rem;
}

.add-studio-modal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #34495e;
    font-size: 0.9rem;
}

.add-studio-modal .form-group.form-group-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.add-studio-modal .form-group.form-group-inline label:first-child {
    margin-bottom: 0;
}

.add-studio-modal .form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.add-studio-modal .form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.add-studio-modal .form-control:disabled {
    background-color: #f5f6f8;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 1;
}

.add-studio-modal .field-lock-icon {
    margin-left: 0.4rem;
    font-size: 0.85rem;
    opacity: 0.7;
    vertical-align: middle;
}

.add-studio-modal .field-note {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: #6c757d;
    font-style: italic;
    line-height: 1.35;
}

.add-studio-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #ecf0f1;
}

/* Ensure buttons don't stretch full width */
.add-studio-modal .modal-footer .btn {
    width: auto;
}

.add-studio-modal .btn-secondary {
    background-color: #6c757d;
    color: white;
}

.add-studio-modal .btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.add-studio-modal .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.add-studio-modal .btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.add-studio-modal .error-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin-top: 1rem;
}

.add-studio-modal .error-icon {
    font-size: 1.2rem;
}

/* ── Desktop ───────────────────────────────────────────────── */
@media (min-width: 769px) {
    .add-studio-modal {
        padding-left: 250px;
    }
}

/* ── Credentials Panel ─────────────────────────────────────── */
.credentials-panel {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    background: #fafbfc;
}

.credentials-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 0.75rem 0;
}

.credentials-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #7f8c8d;
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

.credentials-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.credentials-status-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.credentials-status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
}

.credentials-status-indicator {
    font-size: 1rem;
    flex-shrink: 0;
}

.credentials-status-label {
    font-weight: 600;
    color: #34495e;
}

.credentials-status-date {
    color: #95a5a6;
    font-size: 0.8rem;
    margin-left: auto;
}

.credentials-overall {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

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

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

.credentials-form-section {
    border-top: 1px solid #ecf0f1;
    padding-top: 1rem;
}

.credentials-form-group {
    margin-bottom: 0.75rem;
}

.credentials-form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
    color: #34495e;
    font-size: 0.85rem;
}

.credentials-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.credentials-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.credentials-submit-btn {
    width: 100%;
    margin-top: 0.25rem;
    justify-content: center;
}

.credentials-feedback {
    margin-top: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

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

.credentials-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.credentials-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #004085;
    line-height: 1.4;
}

.credentials-callout-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.credentials-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

.credentials-toggle-btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

/* ── Credentials Warning Pill (site card) ──────────────────── */
.creds-warning-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    cursor: help;
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── Credentials Section in Edit Modal ─────────────────────── */
.modal-credentials-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 2px solid #e1e8ed;
}

.modal-credentials-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 0.75rem 0;
}

/* -- WL Environment picker (StudioCredentialsPanel + AddStudioModal) -- */
.credentials-required { color: #c0392b; margin-left: 0.15rem; }

.credentials-help-icon, .field-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 0.35rem;
    border-radius: 50%;
    background: #dee2e6;
    color: #495057;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: help;
    user-select: none;
}

.credentials-input-error {
    border-color: #c0392b !important;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1) !important;
}

.credentials-url-preview {
    margin-top: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: #f4f6f8;
    border: 1px dashed #ced4da;
    border-radius: 6px;
    font-size: 0.78rem;
    color: #495057;
    word-break: break-all;
    line-height: 1.4;
}

.credentials-url-preview-arrow {
    color: #3498db;
    margin-right: 0.35rem;
    font-weight: 700;
}

.credentials-url-preview-sep {
    color: #adb5bd;
    margin: 0 0.4rem;
}
