/* WhatsApp Instances Styles */

.instances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.instance-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.instance-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.instance-info h5 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
}

.instance-info small {
    color: #666;
    font-size: 13px;
}

.instance-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.instance-status.status-connected {
    background: #d4edda;
    color: #155724;
}

.instance-status.status-connecting {
    background: #fff3cd;
    color: #856404;
}

.instance-status.status-qr_code {
    background: #d1ecf1;
    color: #0c5460;
}

.instance-status.status-disconnected {
    background: #e2e3e5;
    color: #383d41;
}

.instance-status.status-error {
    background: #f8d7da;
    color: #721c24;
}

.instance-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 15px;
}

.instance-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.instance-actions .btn {
    flex: 1;
    min-width: 100px;
    font-size: 13px;
    padding: 8px 12px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
}

.page-header .text-muted {
    margin: 5px 0 0 0;
    font-size: 14px;
}

/* Modal Styles */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: #f8f9fa;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-group-toggle label {
    cursor: pointer;
    padding: 10px 15px;
    border: 2px solid #007bff;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-group-toggle label:hover {
    background: #e7f3ff;
}

.btn-group-toggle input[type="radio"] {
    display: none;
}

.btn-group-toggle input[type="radio"]:checked + label,
.btn-group-toggle label:has(input[type="radio"]:checked) {
    background: #007bff;
    color: white;
}

/* QR Code Display */
#qr-code-display img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

#qr-code-display canvas {
    max-width: 100%;
    height: auto;
}

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

.empty-state i {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 20px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .instances-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .instance-actions {
        flex-direction: column;
    }
    
    .instance-actions .btn {
        width: 100%;
    }
    
    .settings-list {
        grid-template-columns: 1fr;
    }
}

/* Settings List with Toggle Switches */
.settings-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background 0.2s;
}

.setting-item:hover {
    background: #e9ecef;
}

.setting-info {
    flex: 1;
    padding-right: 12px;
}

.setting-title {
    font-weight: 600;
    font-size: 14px;
    color: #212529;
    margin-bottom: 4px;
}

.setting-description {
    font-size: 12px;
    color: #6c757d;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    margin: 0;
    cursor: pointer;
}

.toggle-switch input {
    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: 26px;
}

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

.toggle-switch input:checked + .toggle-slider {
    background-color: #25D366;
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px #25D366;
}

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

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}
